Pages

Tuesday, July 17, 2012

Jdbc driver time out.

Recently I deployed an app on glassfish and it worked really well for about half a day and then it threw an exception each time the service was called. Following is the excetion

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No 
operations allowed after statement closed.
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance 
(NativeConstructorAccessorImpl. java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Deleg
 
Later found out that the jdbc driver connection automatically 
expires after 12 hours.  Setting conncetTimeout to 0 in the 
jdbc connect url as a parameter resolved the problem.

No comments:

Post a Comment