MySQL Connection Timeout Issue - Grails Application on Tomcat using Hibernate and ORM

后端 未结 7 2165
青春惊慌失措
青春惊慌失措 2020-12-08 07:42

I have a small grails application running on Tomcat in Ubuntu on a VPS. I use MySql as my datastore and everything works fine unless I leave the application for more than ha

7条回答
  •  情深已故
    2020-12-08 08:36

    Try increasing the number of open MySQL connections by putting the following in your DataSources.groovy:

    dataSource {
         driverClassName = "com.mysql.jdbc.Driver"
         pooled=true
         maxActive=10
         initialSize=5
         // Remaining connection params
    }
    

    If you want to go the whole hog, try implementing a connection pool; here is a useful link on this.

提交回复
热议问题