From: | Kris Jurka <books(at)ejurka(dot)com> |
---|---|
To: | Heikki Linnakangas <heikki(at)enterprisedb(dot)com> |
Cc: | Luca Ferrari <fluca1978(at)infinito(dot)it>, pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: a simple example of XA (not working) |
Date: | 2007-06-22 21:05:02 |
Message-ID: | Pine.BSO.4.64.0706221659120.23726@leary.csoft.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
On Sun, 17 Jun 2007, Heikki Linnakangas wrote:
> getConnection sets autocommit to false, so even though start set it to true,
> it's reset to false in the call to getConnection. Attached patch fixes that
> by explicitly setting autocommit to the right mode in
> PGXAConnection.getConnection.
>
I don't think this fixes the problem completely if you have code
that calls XAConnection.getConnection more than once:
PGXADataSource xads = new PGXADataSource();
XAConnection xaconn = xads.getXAConnection();
XAResource xares = xaconn.getXAResource();
xares.start(xid, XAResource.TMNOFLAGS);
Connection conn1 = xaconn.getConnection();
conn1.createStatement().executeUpdate(...);
Connection conn2 = xaconn.getConnection();
The second call to get connection will result in:
setAutoCommit(true);
setAutoCommit(false);
on the real underlying connection, which will end up committing that part
of the transaction.
Kris Jurka
From | Date | Subject | |
---|---|---|---|
Next Message | tomasz brymora | 2007-06-22 21:29:24 | creating temporary table PostgreSql 8.1 and iBatis 2.3 |
Previous Message | Heikki Linnakangas | 2007-06-22 19:53:33 | Re: Unable to compile java file with all Classpaths set |