| Bug #62693 | XAConnection savepoint capability | ||
|---|---|---|---|
| Submitted: | 12 Oct 2011 7:04 | Modified: | 19 Oct 13:56 |
| Reporter: | Mina R Waheeb | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / J | Severity: | S3 (Non-critical) |
| Version: | 5.1.18 | OS: | Any |
| Assigned to: | Assigned Account | CPU Architecture: | Any |
| Tags: | XA Savepoint | ||
[25 Apr 2013 9:49]
Alexander Soklakov
Hi Mina, Thanks for your report! Savepoints inside XA transactions are supported by server, at least in MySQL <= 5.5.15 and >= 5.5.23, 5.6.6 (see http://bugs.mysql.com/bug.php?id=64374), so c/J should allow this kind of functionality. Verified by code review.
[19 Oct 13:56]
Edward Gilmore
Posted by developer: Added the following note to the Connector/J 9.5.0 release notes: If a connection was associated with a global XA transaction, invoking the setSavepoint API resulted in an exception, despite the server's capability to create savepoints. Errors were returned similar to the following: java.sql.SQLException: Can't set autocommit to 'true' on an XAConnection

Description: JDBC driver throws exception when invoking setSavepoint API if the connection associated with global XA transaction while the server is capable of creating savepoints! How to repeat: xaDS = getDataSource(); xaCon = xaDS.getXAConnection(); xaRes = xaCon.getXAResource(); con = xaCon.getConnection(); stmt = con.createStatement(); xid = new XidImpl(100, new byte[]{0x01}, new byte[]{0x02}); xaRes.start(xid, XAResource.TMNOFLAGS); Savepoint p = con.setSavepoint(); // It fails! stmt.execute("SAVEPOINT p1"); // It works! con.rollback(p); // It fails! stmt.execute("ROLLBACK TO SAVEPOINT p1"); // It works! mysql> select version(); +-----------+ | version() | +-----------+ | 5.5.12 | +-----------+ Suggested fix: driver should check server version and throws exception in case the server is not capable of creating savepoints!