I'm importing a exists grails project, this project use postgresql use remote postgresql, they built it on real machine, now I need do it on my localhost machine, and use postgresql local.
Everything is OK, but the system can use postgresql, althought I set up it in datasource.config. My datasource.config is similar to old real one, just change something between remote server and local server. Here is my datasource.config.
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
}
// environment specific settings
environments {
production {
pooled = true
driverClassName = "org.postgresql.Driver"
username = "postgres"
password = "postgres"
dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate'
url = "jdbc:postgresql://localhost:5432/faql_dev"
}
}
Here is some error I got:
Caused by: org.compass.gps.device.hibernate.HibernateGpsDeviceException: {hibernate}: Failed to index the database; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query using scroll
at org.compass.gps.device.hibernate.indexer.ScrollableHibernateIndexEntitiesIndexer.performIndex(ScrollableHibernateIndexEntitiesIndexer.java:172)
at org.compass.gps.device.support.parallel.ConcurrentParallelIndexExecutor$1$1.doInCompassWithoutResult(ConcurrentParallelIndexExecutor.java:104)
at org.compass.core.CompassCallbackWithoutResult.doInCompass(CompassCallbackWithoutResult.java:29)
at org.compass.core.CompassTemplate.execute(CompassTemplate.java:133)
at org.compass.gps.impl.SingleCompassGps.executeForIndex(SingleCompassGps.java:147)
at org.compass.gps.device.support.parallel.ConcurrentParallelIndexExecutor$1.call(ConcurrentParallelIndexExecutor.java:102)
... 5 more
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query using scroll
at org.compass.gps.device.hibernate.indexer.ScrollableHibernateIndexEntitiesIndexer.performIndex(ScrollableHibernateIndexEntitiesIndexer.java:118)
... 10 more
Caused by: org.h2.jdbc.JdbcSQLException: Table "QUESTION" not found; SQL statement:
I imported everything involve to postgresql, So I can create table based on domain in development mode, but I can't run it. In production, it will throw that exception.
Thanks in advance!
Caused by: org.h2.jdbc.JdbcSQLException
This suggests to me that you're using the wrong JDBC driver. The data source configuration you've posted only sets the app up to use Postgres in production mode, if you run locally in dev mode then it'll use the default H2 database.
Related
I am new to SSIS, here is the issue I am facing.
1) Created an OLEDB connection to connect to database. Storing the Connection String in SSIS variable and have added expression to Connection Manager to pick the connection string according to environment.
2) Have used Windows Authentication to connect to database, so that no need to provide user ID and Password. In development environment it worked perfectly fine. But when moved to testing environment, its failing with Error "SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "REGEDB" failed with error code 0xC0202009"
3) Using SQL Server Configuration to deploy the package. But getting error Failed to load at least one of the configuration entries for the package. Check configuration entries for "CBPSSIS" and previous warnings to see descriptions of which configuration failed.
Below is the Connection String
Data Source=abcd\ISQLQ02;Initial Catalog=DRIP;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;
COuld you please let me know how to set Password property? I tired in Script file but its not working. Thank you
ConnectionManager OldedbConn;
OldedbConn = Dts.Connections["QAREGE"]; Dts.Connections["QAREGE"].Properties["ServerName"].SetValue(OldedbConn, Dts.Variables["User::dbServerName"].Value); Dts.Connections["QAREGE"].Properties["InitialCatalog"].SetValue(OldedbConn, Dts.Variables["User::dbCatalog"].Value); Dts.Connections["QAREGE"].Properties["UserName"].SetValue(OldedbConn, Dts.Variables["User::dbUserID"].Value); Dts.Connections["QAREGE"].Properties["Password"].SetValue(OldedbConn, Dts.Variables["User::dbPwd"].Value);
Since you are using ssis-2008 you can create a ssis configFile with .dtsConfig format with xml configuration file type. Include all your Database connection string in the config file. So when you moved your ssis package to another server you just need to edit the config file and set your connection based on your target server.
I have migrated a project from PowerBuilder 12 classic to Powerbuilder 12.net using PFC. Even though in PB12 the connection to the database is successful that is not true for PB12.net.
I have been debugging for the problem and the DBHandle function in of_IsConnected of pfc_n_tr returns false. In PB12 classic this returns true. I have made a database profile which connects successfully though.
This is the code which checks for a successful connection:
if this.DBHandle() = 0 then
return false
else
return true
end if
I added connect using sqlca; to see the problem before the check but I got:
Transaction already connected in SQLErrText.
What might be the problem?
So the problem was in DB parameters connection for sql server 2008.
I changed the DBMS variable to "SNC SQL Native Client(OLE DB)" and added the Provider='SQLNCLI10' to the DBParm string.
I need some help here. I have configured database migration plugin as the documentation says:
grails.plugin.databasemigration.updateOnStart = true
grails.plugin.databasemigration.updateOnStartFileNames = ['changelog.groovy']
This works fine when running 'grails run-app'. My database is migrated as expected, but how would I get this behavior when deploy my 'grails war' artifact?
I have tested it on tomcat, by manually copying the artifact to tomcat/webapps folder, but during deployment, hibernate complains about missing columns (the one that should have been created by the database migration plugin).
Any ideas?
Thanks!
Are you sure that those two lines of code are available in production environment too?
This is an example of what I normally do in my applications:
environments {
development {
grails.plugin.databasemigration.updateOnStart = true
grails.plugin.databasemigration.updateOnStartFileNames = ['changelog.groovy']
// ... other useful development settings
}
test {
grails.plugin.databasemigration.updateOnStart = true
grails.plugin.databasemigration.autoMigrateScripts = ['RunApp','TestApp']
grails.plugin.databasemigration.forceAutoMigrate = true
grails.plugin.databasemigration.dropOnStart = true
if (loadTestData) {
grails.plugin.databasemigration.updateOnStartFileNames = ['testchangelog.groovy', 'testdata.groovy']
} else {
grails.plugin.databasemigration.updateOnStartFileNames = ['testchangelog.groovy']
// ... something test-related
}
}
production {
grails.plugin.databasemigration.updateOnStart = true
grails.plugin.databasemigration.updateOnStartFileNames = ['changelog.groovy']
// ... production config settings
}
}
Also, be sure to comment out relevant dbCreate entries in DataSource.groovy to avoid issues with migrations.
See this answer to a similar question https://stackoverflow.com/a/25053160/3939511
I find that the default value for grails.plugin.databasemigration.changelogLocation at compile time is correct to have your change-logs included in the production war. I.e. I don't set/change this property in Config.groovy at compile time.
But in deployment I set grails.plugin.databasemigration.changelogLocation = 'migrations', as the change-logs end up in WEB-INF/classes/migrations/ (as groovy scripts, not compiled classes).
I believe if you do a dbm-update that create the patches for you in the destination database.
Grabbed this from the Grails site.
http://grails-plugins.github.io/grails-database-migration/docs/manual/ref/Update%20Scripts/dbm-update.html
dbm-update
Purpose
Updates a database to the current version.
Description
Runs all un-run changeSets from the changelog. Executes against the database configured in DataSource.groovy for the current environment (defaults to dev).
Usage:
I am setting up a Grails 2.3.5 App on a Heroku Server and I keep getting the following error when tomcat starts up:
Caused by: java.sql.SQLException: Driver:com.mysql.jdbc.Driver#5a7359fe returned null for URL:jdbc:h2:mem:grailsDB;MVCC=TRUE;LOCK_TIMEOUT=10000
I am not using h2 as the Database. I would like to use ClearDB. My environment variables all look correct and everything looks correct in DataSource.groovy. I even setup the connection string to be hard coded to see if this would make a difference. Nada.
production {
datasource {
dbCreate = "create-drop"
url = "jdbc:mysql://us-cdbr-east-05.cleardb.net/heroku_5a952ab6aXXXXXXX?reconnect=true"
username = "XXXXX"
password = "xxxxx"
}
}
Obviously I'm missing something, but I cannot see what.
Where is the production setup getting the h2 connection string from?!
You don't show your full DataSource.groovy file, but it probably has the H2 driver in the top section (driverClassName = "org.h2.Driver"). The values there are the defaults, and the environment-specific blocks are merged into that to create the final settings. You can override that in the production block
production {
datasource {
dbCreate = "create-drop"
url = "jdbc:mysql://us-cdbr-east-05.cleardb.net/heroku_5a952ab6aXXXXXXX?reconnect=true"
username = "XXXXX"
password = "xxxxx"
driverClassName = 'com.mysql.jdbc.Driver'
dialect = org.hibernate.dialect.MySQL5InnoDBDialect
}
}
Additionally, you should always specify the dialect when using MySQL. Grails auto-detects the dialect well in most cases, but can't determine if you're using MyISAM or InnoDB, so it defaults to a dialect that uses the default engine type configured for the whole server. Newer versions of MySQL default to InnoDB and it's easy to change it in any version, but if you don't or it's an older version you'll end up with non-transactional MyISAM tables. Specifying the dialect ensures that your app uses the proper table type.
I found out the reason for my problems.
The code block for data source has a lower case "s" in source. It should have been dataSource, not datasource.
When this block is missing, it appears the default is a h2 database with the name "grailsDB". I could not find this documented anywhere, hence all my confusion.
Check your cases!!!!
I am reading Grails in Action and it says to use
dataSource {
dbCreate = "update"
url = "jdbc:hsqldb:file:devDB;shutdown=true"
}
This causes an error when I run grails console: Unsupported connection setting "SHUTDOWN"
grails console works fine when I remove ;shutdown=true
What is shutdown=true meant to do?
This is described here: http://www.hsqldb.org/doc/guide/ch04.html
It's probably not useful for an in-memory database since it is lost when the web server stops anyway.