Re: XAResource implementation - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: XAResource implementation
Date
Msg-id Pine.BSO.4.64.0711131301130.21066@leary.csoft.net
Whole thread Raw
In response to Re: XAResource implementation  (Heikki Linnakangas <heikki@enterprisedb.com>)
Responses Re: XAResource implementation
List pgsql-jdbc

On Tue, 13 Nov 2007, Heikki Linnakangas wrote:

> It looks like there is indeed a bug in the Postgres driver. I believe it was
> introduced by the recent changes to keep the connection in autocommit mode
> when no XA-transaction is in progress.
>
> It's this call sequence that borks it up:
>
> xares.start()
> conn = xares.getConnection()
> // do stuff
> conn.close();
> conn = xares.getConnection()
> // do more stuff
> xares.end()
> xares.commit()
>
> The 2nd getConnection call inadvertently commits the transaction, and opens
> another one.

When I raised this issue, you said it can't/shouldn't happen.  What's
different now?  It's still a bug in the driver, but is the calling code
doing something it shouldn't?

http://archives.postgresql.org/pgsql-jdbc/2007-06/msg00095.php

> Patch attached. I also added a test for this in the test suite.
>

transaction_timestamp() is an 8.2 feature, but since XA is an 8.1 feature
you should use now() instead.  (No need for a new patch, I've updated mine
here.)

Kris Jurka

pgsql-jdbc by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: XAResource implementation
Next
From: joël Winteregg
Date:
Subject: Re: XAResource implementation