The world's most popular open source database
USA - Toll Free: +1-866-221-0634
USA - From abroad: +1-208-327-6494
USA - Subscription Renewals: +1-866-830-4410
Latin America: +1 512 535 7751
UK: +44 845 399 1124
Ireland: +353 1 6919191
Germany: +49 89 420 95 98 95
France: +33 1 70 61 48 95
Sweden: +46 730 207 871
Benelux: +358 50 5710 528
Italy: +39 06-99268193
Israel: +358 50 5710 528
Spain & Portugal: + 34 933905461
Other EMEA countries: +353 1 6919191
Australia/NZ: +61 2 42314328
Asia Pacific: +81 3 5843 1140
Newsletters older than 6 months may have links that are out of date. Please use the Search to check for updated links.
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

