Heroku Postgres: This connection has been closed

半世苍凉 提交于 2019-12-01 16:28:42

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"
    }
}

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 = "..."
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!