Re: JTA / JDBC support

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Freddy Villalba Arias <fvillalba(at)madrid(dot)bilbomatica(dot)es>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: JTA / JDBC support
Date: 2004-04-05 21:48:58
Message-ID: 4071D44A.1070502@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2004-04-05 21:56:49 Re: what is lslowing me down? JDBC or Postgresql itself?
Previous Message Oliver Jowett 2004-04-05 21:40:37 Re: blob without largeobject api