Thread: Two-phase commit with JDBC
Hi,
Can I use two phase commit in PostgreSQL using JDBC without JTA or XA specialized libraries (I mean, JDBC only)?
Is there any simple J2SE example around?
Thanks,
-- Atenciosamente, Edson Carlos Ericksson Richter
Hi,
Can I use two phase commit in PostgreSQL using JDBC without JTA or XA specialized libraries (I mean, JDBC only)?
Is there any simple J2SE example around?
Thanks,
-- Atenciosamente, Edson Carlos Ericksson Richter
Open Source, Java EE based, Enterprise Content Management (ECM)
http://www.nuxeo.com http://www.nuxeo.org +33 1 40 33 79 87
Two phase commit is a protocol developed by the The Open Group. The group created a standard known as Open XA [1].
PostgreSQL using JDBC provides an implementation of the XA spec. Supporting two phase commit.
The sample application you ask for is beyond J2SE and in JEE [2] instead.
Unless of course you accept using JTA api. This book is suggested reading and has examples. Look for examples with UserTransaction [3].
ISBN 0-13-035290-X
Regards,
Jeremy
[1] https://en.wikipedia.org/wiki/X/Open_XA
[2] https://docs.oracle.com/javaee/7/tutorial/
[3] https://docs.oracle.com/javaee/7/api/javax/transaction/UserTransaction.html
On 25/05/16 00:45, Edson Richter wrote:
Hi,
Can I use two phase commit in PostgreSQL using JDBC without JTA or XA specialized libraries (I mean, JDBC only)?
Is there any simple J2SE example around?
Thanks,
-- Atenciosamente, Edson Carlos Ericksson Richter
-- Jeremy Whiting Senior Software Engineer, JBoss Performance Team Red Hat ------------------------------------------------------------ Registered Address: RED HAT UK LIMITED, Peninsular House, 30-36 Monument Street, 4th floor, London. EC3R 8NB United Kingdom Registered in UK and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (US), Michael ("Mike") O'Neill (Ireland) and Eric Shander (US)
Hi,
Can I use two phase commit in PostgreSQL using JDBC without JTA or XA specialized libraries (I mean, JDBC only)?
Is there any simple J2SE example around?
Thanks,
-- Atenciosamente, Edson Carlos Ericksson Richter
Open Source, Java EE based, Enterprise Content Management (ECM)
http://www.nuxeo.com http://www.nuxeo.org +33 1 40 33 79 87
Two phase commit is a protocol developed by the The Open Group. The group created a standard known as Open XA [1].
PostgreSQL using JDBC provides an implementation of the XA spec. Supporting two phase commit.
The sample application you ask for is beyond J2SE and in JEE [2] instead.
Unless of course you accept using JTA api. This book is suggested reading and has examples. Look for examples with UserTransaction [3].
ISBN 0-13-035290-X
Regards,
Jeremy
[1] https://en.wikipedia.org/wiki/X/Open_XA
[2] https://docs.oracle.com/javaee/7/tutorial/
[3] https://docs.oracle.com/javaee/7/api/javax/transaction/UserTransaction.html
On 25/05/16 00:45, Edson Richter wrote:
Hi,
Can I use two phase commit in PostgreSQL using JDBC without JTA or XA specialized libraries (I mean, JDBC only)?
Is there any simple J2SE example around?
Thanks,
-- Atenciosamente, Edson Carlos Ericksson Richter
-- Jeremy Whiting Senior Software Engineer, JBoss Performance Team Red Hat ------------------------------------------------------------ Registered Address: RED HAT UK LIMITED, Peninsular House, 30-36 Monument Street, 4th floor, London. EC3R 8NB United Kingdom Registered in UK and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (US), Michael ("Mike") O'Neill (Ireland) and Eric Shander (US)
Hi,
Can I use two phase commit in PostgreSQL using JDBC without JTA or XA specialized libraries (I mean, JDBC only)?
Is there any simple J2SE example around?
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Hi,
Can I use two phase commit in PostgreSQL using JDBC without JTA or XA specialized libraries (I mean, JDBC only)?
Is there any simple J2SE example around?
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From: pgsql-jdbc-owner@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.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:
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
From: pgsql-jdbc-owner@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.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:
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