I noticed that a web application deployed on tomcat application server kept throwing JDBC exceptions after every couple of days. So I guessed that it must be a problem with mysql database connection timing out. I did quick search on the issue and found this article explaining the problem. You need to switch from the default Hibernate connection pooling to one of the production grade database connection pooling technology and set appropriate timeout settings.
You will also need to create a c3p0.properties file containing following values;
# a good mysql test query
c3p0.preferredTestQuery=SELECT 1
c3p0.testConnectionOnCheckout=true
You will also need to create a c3p0.properties file containing following values;
# a good mysql test query
c3p0.preferredTestQuery=SELECT 1
c3p0.testConnectionOnCheckout=true
Comments