In my BuildConfig.groovy
I have :
dependencies {
runtime 'org.postgresql:postgresql:9.3-1100-jdbc41'
}
In my DataSource.groovy
I have :
dataSource {
pooled = true
driverClassName = "org.postgresql.Driver"
dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate {
cache.use_second_level_cache=true
cache.use_query_cache=true
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
}
// environment specific settings
environments {
development {
dataSource {
dbCreate = "create-drop" // one of 'create', 'create-drop','update'
url = "jdbc:postgresql://ip:5432/security_dev"
username = "uname"
password = "pwd"
}
}
test {
dataSource {
dbCreate = "create-drop" // one of 'create', 'create-drop','update'
url = "jdbc:postgresql://ip:5432/security_dev"
username = "uname"
password = "pwd"
}
}
production {
dataSource {
dbCreate = "update" // one of 'create', 'create-drop','update'
url = "jdbc:postgresql://ip:5432/security_dev"
username = "uname"
password = "pwd"
}
}
}
}
Here are the error message
2014-04-08 15:02:48,390 [localhost-startStop-1] ERROR pool.ConnectionPool - Unable to create initial connections of pool.
Message: Driver:org.postgresql.Driver@afd862b returned null for URL:jdbc:h2:mem:grailsDB;MVCC=TRUE;LOCK_TIMEOUT=10000
Line | Method
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 744 | run in java.lang.Thread
Error |
2014-04-08 15:02:48,708 [localhost-startStop-1] ERROR pool.ConnectionPool - Unable to create initial connections of pool.
Message: Driver:org.postgresql.Driver@30535975 returned null for URL:jdbc:h2:mem:grailsDB;MVCC=TRUE;LOCK_TIMEOUT=10000
Line | Method
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 744 | run in java.lang.Thread
Error |
2014-04-08 15:02:48,723 [localhost-startStop-1] ERROR pool.ConnectionPool - Unable to create initial connections of pool.
Message: Driver:org.postgresql.Driver@563105a6 returned null for URL:jdbc:h2:mem:grailsDB;MVCC=TRUE;LOCK_TIMEOUT=10000
Line | Method
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 744 | run in java.lang.Thread
|Server running. Browse to http://localhost:8080/Postgresql_Grails_2.3.7
This configuration works for grails 2.2.4
What I have to do to make it work under grails 2.3.7?
Thanks in advance
I had the same problem after my upgrade. This is my dependencies (jdbc4 and not jdbc41):
dependencies {
runtime 'org.postgresql:postgresql:9.3-1100-jdbc4'
}
And I don't know if it is the problem, but I think you left '}' before hibernate:
dataSource {
pooled = true
driverClassName = "org.postgresql.Driver"
username = "username"
password = "password"
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
singleSession = true
}