problem doing insert into a table when using XAConnection

problem doing insert into a table when using XAConnection

am 12.09.2006 23:46:54 von Sadhana Jain

------_=_NextPart_001_01C6D6B4.F71FE7A0
Content-Type: multipart/alternative;
boundary="----_=_NextPart_002_01C6D6B4.F71FE7A0"


------_=_NextPart_002_01C6D6B4.F71FE7A0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi,

=20

I am using MySql latest server (5.0.24) and the
mysql-connector-java-5.0.3-bin.jar driver.=20

=20

I am attaching the sample problem I wrote to isolate the bug. When using
the XAConnection

(setting testWithXA=3Dtrue) and doing the insert into the table, the
executeUpdate succeeds and returns 1 but

Nothing gets written to the table.

=20

When using non-XA connection (setting testWithXA=3Dfalse), the entry =
gets
inserted into the table fine.

=20

The output of the program with XA (or non-XA):

=20

URL string is:jdbc:mysql://localhost:3306/test

UserId: root Password: password

XAConnection Successful!

Connection successful!

1 -> uuid:3BADFD00-C692-D46C-193A-E511ED7E9453

2 -> 1158085128

3 -> 0

4 -> 86400000

5 -> 1158085695

num rows written =3D1

=20

Using command line client (when XA):

mysql> select * from SequenceHistory;

Empty set (0.00 sec)

=20

Using command line client (when non XA):

mysql> select * from SequenceHistory;

+-------------------------------------------+--------------- ----+-------
-+------

--------+----------------+-------------------+-------------- --+

| sequenceID | lastMessageNumber | closed
| creat

ionTime | lastAccessTime | inactivityTimeout | expirationTime |

+-------------------------------------------+--------------- ----+-------
-+------

--------+----------------+-------------------+-------------- --+

| uuid:3BADFD00-C692-D46C-193A-E511ED7E9453 | 0 | 0
| 115

8085128 | 1158085695 | 86400000 | 0 |

+-------------------------------------------+--------------- ----+-------
-+------

--------+----------------+-------------------+-------------- --+

1 row in set (0.21 sec)

=20

=20

Can someone please tell me if I am missing some settings when using
XAConnection or this seems like a bug with MySQL?

=20

Thanks very much for any help!

Sadhana


------_=_NextPart_002_01C6D6B4.F71FE7A0
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">


charset=3Dus-ascii">









style=3D'font-size:10.0pt;
font-family:Arial'>Hi,



style=3D'font-size:10.0pt;
font-family:Arial'> 



style=3D'font-size:10.0pt;
font-family:Arial'>I am using MySql latest server (5.0.24) and the =
mysql-connector-java-5.0.3-bin.jar
driver.



style=3D'font-size:10.0pt;
font-family:Arial'> 



style=3D'font-size:10.0pt;
font-family:Arial'>I am attaching the sample problem I wrote to isolate =
the
bug. When using the XAConnection



style=3D'font-size:10.0pt;
font-family:Arial'>(setting testWithXA=3Dtrue) and doing the insert into =
the
table, the executeUpdate succeeds and returns 1 =
but



style=3D'font-size:10.0pt;
font-family:Arial'>Nothing gets written to the =
table.



style=3D'font-size:10.0pt;
font-family:Arial'> 



style=3D'font-size:10.0pt;
font-family:Arial'>When using non-XA connection (setting =
testWithXA=3Dfalse), the
entry gets inserted into the table fine.



style=3D'font-size:10.0pt;
font-family:Arial'> 



style=3D'font-size:10.0pt;
font-family:Arial'>The output of the program with XA (or =
non-XA):



style=3D'font-size:10.0pt;
font-family:Arial'> 



style=3D'font-size:10.0pt;
font-family:Arial'>URL string =
is:jdbc:mysql://localhost:3306/test



style=3D'font-size:10.0pt;
font-family:Arial'>UserId: root Password: =
password



style=3D'font-size:10.0pt;
font-family:Arial'>XAConnection Successful!



style=3D'font-size:10.0pt;
font-family:Arial'>Connection successful!



style=3D'font-size:10.0pt;
font-family:Arial'> 1 -> =
uuid:3BADFD00-C692-D46C-193A-E511ED7E9453



style=3D'font-size:10.0pt;
font-family:Arial'> 2 -> 1158085128



style=3D'font-size:10.0pt;
font-family:Arial'> 3 -> 0



style=3D'font-size:10.0pt;
font-family:Arial'> 4 -> 86400000



style=3D'font-size:10.0pt;
font-family:Arial'> 5 -> 1158085695



style=3D'font-size:10.0pt;
font-family:Arial'>num rows written =3D1



style=3D'font-size:10.0pt;
font-family:Arial'> 



style=3D'font-size:10.0pt;
font-family:Arial'>Using command line client (when =
XA):



style=3D'font-size:10.0pt;
font-family:Arial'>mysql> select * from =
SequenceHistory;



style=3D'font-size:10.0pt;
font-family:Arial'>Empty set (0.00 sec)



style=3D'font-size:10.0pt;
font-family:Arial'> 



style=3D'font-size:10.0pt;
font-family:Arial'>Using command line client (when non =
XA):



style=3D'font-size:10.0pt;
font-family:Arial'>mysql> select * from =
SequenceHistory;



style=3D'font-size:10.0pt;
font-family:Arial'>+---------------------------------------- ---+---------=
----------+--------+------



style=3D'font-size:10.0pt;
font-family:Arial'>--------+----------------+--------------- ----+--------=
--------+



style=3D'font-size:10.0pt;
font-family:Arial'>|
sequenceID          &nb=
sp;           &nbs=
p;        
| lastMessageNumber | closed | creat



style=3D'font-size:10.0pt;
font-family:Arial'>ionTime | lastAccessTime | inactivityTimeout |
expirationTime |



style=3D'font-size:10.0pt;
font-family:Arial'>+---------------------------------------- ---+---------=
----------+--------+------



style=3D'font-size:10.0pt;
font-family:Arial'>--------+----------------+--------------- ----+--------=
--------+



style=3D'font-size:10.0pt;
font-family:Arial'>| uuid:3BADFD00-C692-D46C-193A-E511ED7E9453 |  =
            &=
nbsp;  0
|      0 |   =
115



style=3D'font-size:10.0pt;
font-family:Arial'>8085128 |     1158085695
|          86400000
|            =
 
0 |



style=3D'font-size:10.0pt;
font-family:Arial'>+---------------------------------------- ---+---------=
----------+--------+------



style=3D'font-size:10.0pt;
font-family:Arial'>--------+----------------+--------------- ----+--------=
--------+



style=3D'font-size:10.0pt;
font-family:Arial'>1 row in set (0.21 sec)



style=3D'font-size:10.0pt;
font-family:Arial'> 



style=3D'font-size:10.0pt;
font-family:Arial'> 



style=3D'font-size:10.0pt;
font-family:Arial'>Can someone please tell me if I am missing some =
settings
when using XAConnection or this seems like a bug with =
MySQL?



style=3D'font-size:10.0pt;
font-family:Arial'> 



style=3D'font-size:10.0pt;
font-family:Arial'>Thanks very much for any =
help!



style=3D'font-size:10.0pt;
font-family:Arial'>Sadhana









------_=_NextPart_002_01C6D6B4.F71FE7A0--


------_=_NextPart_001_01C6D6B4.F71FE7A0
Content-Type: text/plain; charset=us-ascii


--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org
------_=_NextPart_001_01C6D6B4.F71FE7A0--

Re: problem doing insert into a table when using XAConnection

am 15.09.2006 11:45:40 von Tonci Grgin

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

Hi Sadhana.

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

--
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/bugs?unsub=gcdmb-bugs@m.gmane.org

RE: problem doing insert into a table when using XAConnection

am 15.09.2006 19:08:41 von Sadhana Jain

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:tonci@mysql.com]=20
Sent: Friday, September 15, 2006 2:46 AM
To: Sadhana Jain
Cc: bugs@lists.mysql.com
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/bugs?unsub=3Dgcdmb-bugs@m.gmane.org

Re: problem doing insert into a table when using XAConnection

am 15.09.2006 19:47:23 von Mark Matthews

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sadhana Jain wrote:
> 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).
>
> A. Works.
>
> DataSource ds = (DataSource) createXADataSource();
> Connection conn = ds.getConnection();
> System.out.println("auto commit value ="+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 = createXADataSource();
> XAConnection xconn = xds.getXAConnection();
> Connection conn = xconn.getConnection();
> System.out.println("auto commit value ="+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

Hi Sadhana,

Just a clarification that auto-commit being disabled on an XAConnection
is by design (and is required by the JDBC specification).

-Mark
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFCucrtvXNTca6JD8RAn4kAKCzSYs/SVFT4SrhQLuDDpSj3h1SOgCg iQ2e
DBofwmwH4IvvQYWH/R1gV04=
=n3mz
-----END PGP SIGNATURE-----

--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org

RE: problem doing insert into a table when using XAConnection

am 15.09.2006 19:55:41 von Sadhana Jain

-----Original Message-----
From: Mark Matthews [mailto:mark@mysql.com]=20
Sent: Friday, September 15, 2006 10:47 AM
To: Sadhana Jain
Cc: tonci@mysql.com; bugs@lists.mysql.com
Subject: Re: problem doing insert into a table when using XAConnection

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sadhana Jain wrote:
> Hi Tonci,
>=20
> 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
>=20
> A. Works.
>=20
> DataSource ds =3D (DataSource) createXADataSource();
> Connection conn =3D ds.getConnection();
> System.out.println("auto commit value =3D"+conn.getAutoCommit());
>=20
> The auto commit value is set to true in this case and the insert into
> the table worked fine after this.
>=20
> However, if I was using:
> B. Doesn't work.
>=20
> XADataSource xds =3D createXADataSource();
> XAConnection xconn =3D xds.getXAConnection();
> Connection conn =3D xconn.getConnection();
> System.out.println("auto commit value =3D"+conn.getAutoCommit());
>=20
> The auto commit value is set to false. And the insert into the table
> didn't happen.
>=20
> I am using Case A now and it works fine.
> Thanks for your reply.
>=20
> Hope this helps.
> Sadhana

Hi Sadhana,

Just a clarification that auto-commit being disabled on an XAConnection
is by design (and is required by the JDBC specification).

-Mark
True. I realized that too that case B also works as expected (per the
spec) but didn't work in my situation.
Thanks,
Sadhana

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFCucrtvXNTca6JD8RAn4kAKCzSYs/SVFT4SrhQLuDDpSj3h1SOgCg iQ2e
DBofwmwH4IvvQYWH/R1gV04=3D
=3Dn3mz
-----END PGP SIGNATURE-----

--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=3Dgcdmb-bugs@m.gmane.org