I have a Grails app communicating with an ingres database via domain classes. When the database crashes or I restarted it while the application is running I get an Exception:
| Error Caused by: java.sql.SQLTransactionRollbackException: Connection failed.
This exception then comes every time and forever when I access the database altough the database is back again from restart/crash.
How can I force Grails / Hibernate to recreate a connection or set it to recreate automatically.
This is my config:
dataSource {
dbCreate = 'validate'
url = "jdbc:ingres://xxx.xxx.xxx.xxx:II7/test"
driverClassName = "com.ingres.jdbc.IngresDriver"
username = "ingres"
password = "ingres"
jmxEnabled = true
initialSize = 5
maxActive = 50
minIdle = 5
maxIdle = 25
maxWait = 10000
maxAge = 10 * 60000
timeBetweenEvictionRunsMillis = 5000
minEvictableIdleTimeMillis = 60000
validationQuery = "SELECT 1"
validationQueryTimeout = 3
validationInterval = 15000
testOnBorrow = true
testWhileIdle = true
testOnReturn = true
jdbcInterceptors = "ConnectionState"
defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
}
The problem was easy to fix after hours of searching and missing the key information.
In my initial config in my question there was no properties {..}
group around datasource settings. The genius Grails config management didn't warn me about that it is needed. Adding it, everything works fine and GORM can recover from lost connections.