Synchronizing database connections (pooling in Tomcat)

My dB connections keep failing. I have looked at some of the solutions people have suggested to this and have implemented them, but nothing has worked out so far. Any new thoughts will be very helpful.

For some webapp requests, this is the error I get:

com.mysql.jdbc.CommunicationsException: The last packet successfully received from the server was 11,198,881 million ago. The last packet successfully sent to the server was 11,198,881 milliseconds ago. greater than the server-specified "wait_timeout" value. You should consider expiring and / or checking the validity of the connection before using it in your application, increasing the server setting of the value for client timeouts, or using the Connection Connector / J property 'autoReconnect = true' to avoid this issue.

Solutions tried

  • Checking the reliability of the connection
  • Using autoReconnect

Context.xml content

Resource name = "jdbc / dBConnectionMain" auth = "Container" type = "javax.sql.DataSource" maxActive = "20" maxIdle = "18" removeAbandoned = "true" removeAbandonedTimeout = "60" logAbandoned = "true" validationQuery = " select 1 "testOnBorrow =" true "username =" user "password =" password "driverClassName =" com.mysql.jdbc.Driver "url =" jdbc: mysql: // localhost / databaseName? autoReconnect = true "/

Any pointers to this?



source to share

All Articles