Re: problem doing insert into a table when using XAConnection

Mark Matthews <[email protected]> Fri, 15 Sep 2006 12:47:23 -0500
Newsgroups gmane.comp.db.mysql.bugs
Message-ID <[email protected]>
-----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/SVFT4SrhQLuDDpSj3h1SOgCgiQ2e
DBofwmwH4IvvQYWH/R1gV04=
=n3mz
-----END PGP SIGNATURE-----

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