Bug #27832 XAConnection does not allow XA Start xid JOIN
Submitted: 15 Apr 2007 1:59 Modified: 21 May 2007 3:22
Reporter: abayi tay Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: General Severity:S4 (Feature request)
Version:5.0.27-standard OS:Microsoft Windows (XP)
Assigned to: CPU Architecture:Any
Triage: Triaged: D5 (Feature request)

[15 Apr 2007 1:59] abayi tay
Description:
transaction manager jotm 2.0.10 version.

 ut.begin();
 XAConnection xaConn1 = getXAConnection();
 XAResource xaRes1 = xaConn1.getXAResource();
 TM.getTransaction().enlistResource(xaRes1);

 XAConnection xaConn2 = getXAConnection();
 XAResource xaRes2 = xaConn2.getXAResource();
//here will got error.
 TM.getTransaction().enlistResource(xaRes2);

 

How to repeat:
XAER_INVAL: Invalid arguments (or unsupported command)

com.mysql.jdbc.jdbc2.optional.MysqlXAException: XAER_INVAL: Invalid arguments (or unsupported command)
	at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.mapXAExceptionFromSQLException(MysqlXAConnection.java:625)
	at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.dispatchCommand(MysqlXAConnection.java:600)
	at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.start(MysqlXAConnection.java:531)
	at org.objectweb.jotm.TransactionImpl.enlistResource(TransactionImpl.java:432)
	at my.jta.test.XATest.testCoordination(XATest.java:93)
	at my.jta.test.XATest.main(XATest.java:603)

jotm Transaction Manager response
====================================================
javax.transaction.SystemException: Cannot send XA(com.mysql.jdbc.jdbc2.optional.MysqlXAConnection@11756a4) start:com.mysql.jdbc.jdbc2.optional.MysqlXAException: XAER_INVAL: Invalid arguments (or unsupported command) (error code = -5) --XAER_INVAL: Invalid arguments (or unsupported command)
	at org.objectweb.jotm.TransactionImpl.enlistResource(TransactionImpl.java:445)
	at my.jta.test.XATest.testCoordination(XATest.java:93)
	at my.jta.test.XATest.main(XATest.java:603)

Suggested fix:
i tracking it , and found that problem is mysql cant accept below command
============================
"XA start xid JOIN"
============================
(try in mysql client also cant accept it)

when got JOIN command will fail.
so i change below code , that work
====================================
 public boolean isSameRM(XAResource xares) throws XAException
   {

      if (xares instanceof MysqlXAConnection)
      {
//          return this.underlyingConnection.isSameResource( ( (MysqlXAConnection) xares).underlyingConnection);
//new code here
     if (xares.equals(this))
         {
            return true;
         }

          }

      return false;
   }
[9 May 2007 14:39] Tonci Grgin
Hi and thanks for your report. Sorry for the delay in processing.

I have consulted on this problem and all we can think of right now is for you to try adding "pinGlobalTxToPhysicalConnection=true" to your URL. Inform me of result.
[16 May 2007 12:44] abayi tay
below is that response.
=============================================
com.mysql.jdbc.jdbc2.optional.MysqlXAException: XAER_INVAL: Invalid arguments (or unsupported command)
	at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.mapXAExceptionFromSQLException(MysqlXAConnection.java:564)
	at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.dispatchCommand(MysqlXAConnection.java:547)
	at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.start(MysqlXAConnection.java:488)
	at org.objectweb.jotm.TransactionImpl.enlistResource(TransactionImpl.java:432)
	at my.jta.PoolManagerDataSource.enlistTransaction(PoolManagerDataSource.java:255)
	at my.jta.PoolManagerDataSource.getConnection(PoolManagerDataSource.java:192)
	at my.jta.PoolManagerDataSource.getConnection(PoolManagerDataSource.java:172)
	at my.jta.test.XATest.testMultipleConnectionCallAndRelease(XATest.java:751)
	at my.jta.test.XATest.testMultipleConnectionCallAndRelease(XATest.java:773)
	at my.jta.test.XATest.testQueryConnectionBeforeTransactionAndCommit(XATest.java:869)
	at my.jta.test.XATest.main(XATest.java:1246)
[17 May 2007 14:16] Mark Matthews
This is missing functionality from the server. This is not a Connector/J bug.
[21 May 2007 3:22] abayi tay
so got any subject to solve it?
[5 Dec 2007 9:11] Hui Tong
Hi I'm Emtone T.H

Use AtomikosTransactionsEssentials-3.2.1 also can't work

OS:Microsoft Windows (XP)

Error Info:

...
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)
com.atomikos.datasource.ResourceException: resume for XID 10.1.84.253.tm000020010310.1.84.253.tm2 raised -5: invalid arguments were given for the XA operation
...	
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)
Nested exception is: 
com.mysql.jdbc.jdbc2.optional.MysqlXAException: XAER_INVAL: Invalid arguments (or unsupported command)
	at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.mapXAExceptionFromSQLException(MysqlXAConnection.java:567)
	at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.dispatchCommand(MysqlXAConnection.java:550)
	at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.start(MysqlXAConnection.java:490)
	at com.atomikos.datasource.xa.XAResourceTransaction.resume(XAResourceTransaction.java:397)
	at com.atomikos.icatch.jta.TransactionImp.enlistResource(TransactionImp.java:361)
...
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)
com.mysql.jdbc.jdbc2.optional.MysqlXAException: XAER_INVAL: Invalid arguments (or unsupported command)
	at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.mapXAExceptionFromSQLException(MysqlXAConnection.java:567)
	at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.dispatchCommand(MysqlXAConnection.java:550)
	at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.start(MysqlXAConnection.java:490)
	at com.atomikos.datasource.xa.XAResourceTransaction.resume(XAResourceTransaction.java:397)
	at com.atomikos.icatch.jta.TransactionImp.enlistResource(TransactionImp.java:361)
[10 May 2016 8:14] NOT_FOUND NOT_FOUND
Is this solved in the more recent versions of MySQL?
[10 May 2016 9:01] NOT_FOUND NOT_FOUND
Answering my own question: just tried using MySQL Server 5.7.12 and it appears to be still broken.
[16 May 2017 8:23] Benny Bottema
We also still see these symptoms in combination with Atomikos XA.

MySQL Community Server, v5.7.17