If an application uses autoReconnect but disables autoCommit, then the
jdbc driver will fail to reconnect with the database. This can be
demonstrated by setting the wait_timeout on mySQL to 30 seconds, open a
connection with the above options and wait 40 seconds after the
connection is open to execute a query.
Examining the source for the driver (3.0 and 3.1) it is visible that
without autoCommit the database connection cannot be re-established:
Looking at the mySQL jdbc code (from com.mysql.jdbcConnection.java ~
line 1788):
if ((this.highAvailability || this.failedOver) && this.autoCommit) {
try {
ping();
} catch (Exception Ex) {
createNewIO(true);
}
}
I have modified and tested the following code change and it appears to
fix the problem:
if ( this.highAvailability || (this.failedOver && this.autoCommit) ) {
try {
ping();
} catch (Exception Ex) {
createNewIO(true);
}
}
Many mySQL users currently fix the problem by setting autoCommit to true
(which may be undesirable) or increasing the wait_timeout value to a
very large number (which violates the design of the timeout feature).
I can provide further details if anyone is interested.
Richard Hyatt
[EMAIL PROTECTED]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]