Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

2 phase commit

 
Vedhas Pitkar
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,
Can anyone suggest how to implement 2 phase commit for distributed transactions/databases using JDBC/JTA?
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Vedhas Pitkar:
Hi Ranchers,
Can anyone suggest how to implement 2 phase commit for distributed transactions/databases using JDBC/JTA?


Why do need to implement it ? Just use a JDBC driver which is two phase commit compliant.
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
 
Vedhas Pitkar
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Pradip saw the link.Thanks a bundle!! But what happens if part of one transaction takes place on one database & the other part on a diff DB?
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Vedhas Pitkar:
Yes Pradip saw the link.Thanks a bundle!! But what happens if part of one transaction takes place on one database & the other part on a diff DB?


I did not understand your question. Are the databases of the same vendor or a different one?
 
Vedhas Pitkar
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same vendor
Parent Transaction
Child Transacion 1: Database1
Child Transaction 2: Databse 2 (Copy of the above DB but on diff m/c). This transaction updates a diff table than in TX 1.
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should work fine if your are using XA Drivers for accessing database.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic