views:

1954

answers:

1

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 ?

+2  A: 

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: http://stackoverflow.com/questions/520585/connection-pooling-options-with-jdbc-dbcp-vs-c3p0

David Rabinowitz
Thanks for your thoughts.
ashitaka