Re: JTA / JDBC support - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: JTA / JDBC support
Date
Msg-id 4071D44A.1070502@opencloud.com
Whole thread Raw
In response to JTA / JDBC support  ("Freddy Villalba Arias" <fvillalba@madrid.bilbomatica.es>)
List pgsql-jdbc
Freddy Villalba Arias wrote:
> Hi!
>
> Are there any drivers (for PostgreSQL v7.4.2) that support JTA?
>
> I’m interested in using JDBC 2.0, but I encourage you (and would greatly
> appreciate it) to give me as much information as you can about JTA /
> JDBC (different versions) support…

Short answer: the standard postgresql driver doesn't support XAResource,
and it doesn't make sense to support it.

Long answer:

JTA defines XAResource as the interface between the Transaction Manager
(TM) and Resource Manager (RM -- in this case the JDBC driver) for
resources that can participate in two-phase commit of global
transactions. While there's support for a one-phase optimization, that's
an option on the part of the TM, not the RM. There's no specification in
JTA of the interface between the TM and RM for local or one-phase
transactions AFAIK.

As the PostgreSQL backend itself (let alone the driver) doesn't support
two-phase commit or global transactions, it doesn't really make sense
for the driver to implement XAResource. It could implement it and then
refuse all requests to prepare transactions or switch transaction
context, but I don't know how useful that would be since it depends so
much on the TM's behaviour.

But I'd be surprised if your TM of choice did not support enlistment of
one-phase JDBC resources directly (with a bit of help from the app
server, which has to actually do the enlistment at the right point)
using the normal commit/rollback JDBC interface to talk to the driver.

-O

pgsql-jdbc by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: what is lslowing me down? JDBC or Postgresql itself?
Next
From: Oliver Jowett
Date:
Subject: Re: blob without largeobject api