RE: problem doing insert into a table when using XAConnection

"Sadhana Jain" <[email protected]> Fri, 15 Sep 2006 10:08:41 -0700
Newsgroups gmane.comp.db.mysql.bugs
Message-ID <[email protected]>
Hi Tonci,

I later found that it's not a bug in MySql. The problem I was seeing
(for the case when I am not using global transaction) was due to the
fact that auto commit was set to false because I was using XAConnection
to get the Connection object but I didn't have to use XAConnection in
this case (when not in global transaction).=20

A. Works.

DataSource ds =3D (DataSource) createXADataSource();
Connection conn =3D ds.getConnection();
System.out.println("auto commit value =3D"+conn.getAutoCommit());

The auto commit value is set to true in this case and the insert into
the table worked fine after this.

However, if I was using:
B. Doesn't work.

XADataSource xds =3D createXADataSource();
XAConnection xconn =3D xds.getXAConnection();
Connection conn =3D xconn.getConnection();
System.out.println("auto commit value =3D"+conn.getAutoCommit());

The auto commit value is set to false. And the insert into the table
didn't happen.

I am using Case A now and it works fine.
Thanks for your reply.

Hope this helps.
Sadhana




-----Original Message-----
From: Tonci Grgin [mailto:[email protected]]=20
Sent: Friday, September 15, 2006 2:46 AM
To: Sadhana Jain
Cc: [email protected]
Subject: Re: problem doing insert into a table when using XAConnection

Sadhana Jain wrote:
> Hi,
>=20
> =20
>=20
> I am using MySql latest server (5.0.24) and the=20
> mysql-connector-java-5.0.3-bin.jar driver.
>=20
> =20
>=20
> I am attaching the sample problem I wrote to isolate the bug. When
using=20
> the XAConnection
>=20
> (setting testWithXA=3Dtrue) and doing the insert into the table, the=20
> executeUpdate succeeds and returns 1 but
>=20
> Nothing gets written to the table.
>=20
> =20
>=20
> When using non-XA connection (setting testWithXA=3Dfalse), the entry
gets=20
> inserted into the table fine.
>=20
> =20
>=20
> The output of the program with XA (or non-XA):
>=20
> =20
>=20
> URL string is:jdbc:mysql://localhost:3306/test
>=20
> UserId: root Password: password
>=20
> XAConnection Successful!
>=20
> Connection successful!
>=20
>  1 -> uuid:3BADFD00-C692-D46C-193A-E511ED7E9453
>=20
>  2 -> 1158085128
>=20
>  3 -> 0
>=20
>  4 -> 86400000
>=20
>  5 -> 1158085695
>=20
> num rows written =3D1
>=20
> =20
>=20
> Using command line client (when XA):
>=20
> mysql> select * from SequenceHistory;
>=20
> Empty set (0.00 sec)
>=20
> =20
>=20
> Using command line client (when non XA):
>=20
> mysql> select * from SequenceHistory;
>=20
>
+-------------------------------------------+-------------------+-------
-+------
>=20
> --------+----------------+-------------------+----------------+
>=20
> | sequenceID                                | lastMessageNumber |
closed=20
> | creat
>=20
> ionTime | lastAccessTime | inactivityTimeout | expirationTime |
>=20
>
+-------------------------------------------+-------------------+-------
-+------
>=20
> --------+----------------+-------------------+----------------+
>=20
> | uuid:3BADFD00-C692-D46C-193A-E511ED7E9453 |                 0 |
0=20
> |   115
>=20
> 8085128 |     1158085695 |          86400000 |              0 |
>=20
>
+-------------------------------------------+-------------------+-------
-+------
>=20
> --------+----------------+-------------------+----------------+
>=20
> 1 row in set (0.21 sec)
>=20
> =20
>=20
> =20
>=20
> Can someone please tell me if I am missing some settings when using=20
> XAConnection or this seems like a bug with MySQL?
>=20
> =20
>=20
> Thanks very much for any help!
>=20
> Sadhana
>=20
>=20
>
------------------------------------------------------------------------
>=20
>=20

Hi Sadhana.

Can you please provide small but complete java test case demonstrating=20
this problem? I would also like to know more of your environment.

--=20
Tonci Grgin, Support Engineer
MySQL AB, Croatia, www.mysql.com

Are you MySQL certified?  www.mysql.com/certification

-- 
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe:    http://lists.mysql.com/[email protected]