Bug #86741 | Multi-Host connection with autocommit=0 getAutoCommit maybe wrong | ||
---|---|---|---|
Submitted: | 19 Jun 2017 2:36 | Modified: | 27 Jul 2019 14:36 |
Reporter: | Jiajing Zhou | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / J | Severity: | S2 (Serious) |
Version: | 5.1.31, 5.1.39 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | 5.1.31, 5.1.39, jdbc |
[19 Jun 2017 2:36]
Jiajing Zhou
[20 Jun 2017 11:51]
Chiranjeevi Battula
Hello Jiajing, Thank you for the bug report and test case. Verified this behavior on MySQL Connector / J 5.1.39. Thanks, Chiranjeevi.
[20 Jun 2017 11:51]
Chiranjeevi Battula
output: run: 0 true BUILD SUCCESSFUL (total time: 0 seconds)
[20 Feb 2018 18:31]
Daniel So
Posted by developer: Added the following entry to the Connector/J 5.1.46 changelog: " For multi-host connections, when a MySQL Server was configured with autocommit=0, Connection.getAutoCommit() did not return the correct value. This was because useLocalSessionState=true was assumed for multi-host connections, which might not be the case, resulting thus in inconsistent session states. With the fix, by default, Connector/J executes some extra queries in the connection synchronization process to guarantee consistent session states between the client and the server at any connection switch. This would mean, however, that when none of the hosts are available during an attempted server switch, an exception for closed connection will be thrown immediately while, in earlier Connector/J versions, there would be a connection error thrown first before a closed connection error. Error handling in some applications might need to be adjusted accordingly. Applications can skip the new session state synchronization mechanism by having useLocalSessionState=true. "
[27 Jul 2019 14:36]
Jiajing Zhou
Thanks.