Re: Two-phase commit with JDBC

From: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
To: Edson Richter <edsonrichter(at)hotmail(dot)com>
Cc: Florent Guillaume <fguillaume(at)nuxeo(dot)com>, List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Two-phase commit with JDBC
Date: 2016-05-26 01:41:25
Message-ID: 0A3221C70F24FB45833433255569204D1F57A678@G01JPEXMBYT05
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

From: pgsql-jdbc-owner(at)postgresql(dot)org [mailto:pgsql-jdbc-owner(at)postgresql(dot)org] On Behalf Of Florent Guillaume
This is not PostgreSQL-specific.

You have to acquire a XADataSource then a XAConnection from it then its Connection.

Here's a unit test doing the two phases:
https://github.com/pgjdbc/pgjdbc/blob/master/pgjdbc/src/test/java/org/postgresql/test/xa/XADataSourceTest.java#L174

And the chapter “Distributed Transaction” in the JDBC specification will help you to understand the API usage and the above test cases.

Regards
Takayuki Tsunakawa

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Vladimir Sitnikov 2016-05-29 14:37:35 Re: Roadmap: JDK 9 testing.
Previous Message Dave Cramer 2016-05-25 20:26:22 Re: Support for WITH Queries (Common Table Expressions)