Skip site navigation (1) Skip section navigation (2)

Re: XAResource implementation

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: joël Winteregg <joel(dot)winteregg(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: XAResource implementation
Date: 2007-11-12 09:59:52
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
joël Winteregg wrote:
> I said that BTM TransactionManager was "mostly" working because when I
> was using the XA implementation, SQL BEGIN and COMMIT where generated
> arround each SQL query (even if several queries were located inside the
> same transaction). So at the end, I used the TransactionManager with the
> "Last Resource Commit Optimization" which allow the use of a pure jdbc
> driver during transaction (I only have a single DB (1 Phase Commit) so
> it is 100% safe to use this specificity). In this case, my BEGIN and
> COMMIT statement where just perfect:
>   SELECT ..
>   SELECT ..
>   SELECT ..
> So I was just wondering if my XA problem (BEGIN and COMMIT location when
> using XA) could come from the postgresql XA driver ?

Hmm. I downloaded the BTM and modified it to run with 
Postgres, and to run two queries in same transaction. Works for me.

Attached is the modified I used. To run:
0. Download from
1. Put postgresql.jar in newUserDemo/lib
2. Copy the attached to newUserDemo/src/jtatest
3. Modify database/username/password in if necessary
4. Run the CREATE TABLE from derby-create.sql

Here's what I get in the Postgres log, with log_statements='all':

LOG:  execute <unnamed>: SELECT gid FROM pg_prepared_xacts
LOG:  execute S_1: BEGIN
LOG:  execute <unnamed>: insert into messages(content) values ($1)
DETAIL:  parameters: $1 = 'hello, world!'
LOG:  execute S_2: COMMIT
LOG:  execute S_1: BEGIN
LOG:  execute <unnamed>: select content from messages
LOG:  execute <unnamed>: select content from messages
LOG:  execute S_2: COMMIT

   Heikki Linnakangas

Description: text/x-java (2.1 KB)

In response to


pgsql-jdbc by date

Next:From: joël WintereggDate: 2007-11-13 07:30:10
Subject: Re: XAResource implementation
Previous:From: joël WintereggDate: 2007-11-11 22:25:33
Subject: Re: XAResource implementation

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group