Bug #62693 XAConnection savepoint capability
Submitted: 12 Oct 2011 7:04 Modified: 25 Apr 2013 9:49
Reporter: Mina R Waheeb Email Updates:
Status: Verified 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.