I developed a small Heroku + Grails + Postreg application. It would work fine somewhat 20 minutes after deployment, after that I always get:
This connection
A combination of @Macchiatow's answer and @Jonik's comment, this is what I used to work, with fewer properties:
dataSource {
pooled = true
properties {
testOnBorrow = true
testWhileIdle = true
testOnReturn = true
validationQuery = "SELECT 1"
}
driverClassName = "org.postgresql.Driver"
dialect = "..."
}
I have resolved it myself by adding this to DataSource.groovy:
dataSource {
pooled = true
properties {
maxActive = -1
minEvictableIdleTimeMillis=1800000
timeBetweenEvictionRunsMillis=1800000
numTestsPerEvictionRun=3
testOnBorrow=true
testWhileIdle=true
testOnReturn=true
validationQuery="SELECT 1"
}
}