Italia: +39 06 99268193
USA Subscription Renewals: +1-866-830-4410
EMEA: +353 1 6919191
Scopri nuovi rilasci, articoli tecnici, eventi ed altro ancora.
I have a servlet/application that works fine for a day, and then stops working overnight? What can I do?
MySQL closes connections after 8 hours of inactivity. You either need to use a connection pool that handles stale connections or use the "autoReconnect" parameter (see "Developing Applications with MySQL Connector/J").
Also, you should be catching SQLExceptions in your application and dealing with them, rather than propagating them all the way until your application exits. This is just good programming practice. MySQL Connector/J will set the SQLState to "08S01" when it encounters network-connectivity issues during the processing of a query. Your application code should then attempt to re-connect to MySQL at this point.
Other relevant information can be found in the MySQL documentation at
http://www.mysql.com/documentation/connector-j/index.html#id2802490
