pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedTwo-phase commit with JDBC
5+ messages / 5 participants
[nested] [flat]
* Two-phase commit with JDBC
@ 2016-05-24 23:45 Edson Richter <edsonrichter@hotmail.com>
0 siblings, 3 replies; 5+ messages in thread
From: Edson Richter @ 2016-05-24 23:45 UTC (permalink / raw)
To: pgsql-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
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Two-phase commit with JDBC
@ 2016-05-25 09:57 Florent Guillaume <fguillaume@nuxeo.com>
parent: Edson Richter <edsonrichter@hotmail.com>
2 siblings, 1 reply; 5+ messages in thread
From: Florent Guillaume @ 2016-05-25 09:57 UTC (permalink / raw)
To: Edson Richter <edsonrichter@hotmail.com>; +Cc: pgsql-jdbc
Hi,
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/XADataSourc...
Florent
On Wed, May 25, 2016 at 1:45 AM, Edson Richter <edsonrichter@hotmail.com>
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
>
>
--
Florent Guillaume, Director of R&D, Nuxeo
Open Source, Java EE based, Enterprise Content Management (ECM)
http://www.nuxeo.com http://www.nuxeo.org +33 1 40 33 79 87
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Two-phase commit with JDBC
@ 2016-05-25 10:05 Jeremy Whiting <jwhiting@redhat.com>
parent: Edson Richter <edsonrichter@hotmail.com>
2 siblings, 0 replies; 5+ messages in thread
From: Jeremy Whiting @ 2016-05-25 10:05 UTC (permalink / raw)
To: Edson Richter <edsonrichter@hotmail.com>; +Cc: pgsql-jdbc
Hi Edson,
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)
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Two-phase commit with JDBC
@ 2016-05-25 14:07 Simon Riggs <simon@2ndQuadrant.com>
parent: Edson Richter <edsonrichter@hotmail.com>
2 siblings, 0 replies; 5+ messages in thread
From: Simon Riggs @ 2016-05-25 14:07 UTC (permalink / raw)
To: Edson Richter <edsonrichter@hotmail.com>; +Cc: pgsql-jdbc
On 25 May 2016 at 00:45, Edson Richter <edsonrichter@hotmail.com> wrote:
> Hi,
>
> Can I use two phase commit in PostgreSQL using JDBC without JTA or XA
> specialized libraries (I mean, JDBC only)?
>
Yes. They are just SQL statements.
> Is there any simple J2SE example around?
>
--
Simon Riggs http://www.2ndQuadrant.com/
<http://www.2ndquadrant.com/;
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Two-phase commit with JDBC
@ 2016-05-26 01:41 Tsunakawa, Takayuki <tsunakawa.takay@jp.fujitsu.com>
parent: Florent Guillaume <fguillaume@nuxeo.com>
0 siblings, 0 replies; 5+ messages in thread
From: Tsunakawa, Takayuki @ 2016-05-26 01:41 UTC (permalink / raw)
To: Edson Richter <edsonrichter@hotmail.com>; +Cc: Florent Guillaume <fguillaume@nuxeo.com>; pgsql-jdbc
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:
https://github.com/pgjdbc/pgjdbc/blob/master/pgjdbc/src/test/java/org/postgresql/test/xa/XADataSourc...
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
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2016-05-26 01:41 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-05-24 23:45 Two-phase commit with JDBC Edson Richter <edsonrichter@hotmail.com>
2016-05-25 09:57 ` Florent Guillaume <fguillaume@nuxeo.com>
2016-05-26 01:41 ` Tsunakawa, Takayuki <tsunakawa.takay@jp.fujitsu.com>
2016-05-25 10:05 ` Jeremy Whiting <jwhiting@redhat.com>
2016-05-25 14:07 ` Simon Riggs <simon@2ndQuadrant.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox