In the configuration reference for MySql's connector J driver, a caveat emptor is issued on the use of the autoReconnect property. I followed the instructions and increased my server's wait_timeout. Since I am using DBCP (I am considering moving to c3po after reading several posts on Stackoverflow shooting down DBCP ), is it ok to use the autoReconnectForPools property ? What does it actually do when enabled under DBCP or any connection pool for that matter ?
autoReconnect will throw an SQLException to the client, but will try to re-establish the connection.
autoReconnectForPools will try to ping the server before each SQL execution.
I had a lot of issues with dbcp in the past, especially disconnections. Most were solved by moving to c3p0. Notice that the mysql driver has connection tester for c3p0 (com.mysql.jdbc.integration.c3p0.MysqlConnectionTester).
Also, you may want to check this out: Connection pooling options with JDBC: DBCP vs C3P0