Bug #62693 XAConnection savepoint capability

Submitted: 12 Oct 2011 7:04 Modified: 19 Oct 2025 13:56
Reporter: Mina R Waheeb Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.18 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: XA Savepoint

[12 Oct 2011 7:04] Mina R Waheeb
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!
[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 2025 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

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.050 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.