This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Distributed transactions across multiple databases Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Distributed transactions across multiple databases" Watch "Distributed transactions across multiple databases" New topic
Author

Distributed transactions across multiple databases

Aniket Kedari
Ranch Hand

Joined: Jan 29, 2008
Posts: 30
Hi all,
I am developing an application in which I am using three different databases.(say db1, db2, db3).
Now I insert certain data in each of the databases. But if this insertion fails in any of the databases,
I have to rollback all transactions and terminate process.

Can anybody suggest how this can be achieved.

Thanks in advance,
Aniket
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 20132
    
  30

Moving to JDBC.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Aniket Kedari
Ranch Hand

Joined: Jan 29, 2008
Posts: 30
I tried to use aucommit(false) and then commit on individual connection if no error occurs.
But if there is an error during commit() of second connection, I wont be able to rollback changes done by commit of first database connection.
So is there a better way of doing this?
Aniket Kedari
Ranch Hand

Joined: Jan 29, 2008
Posts: 30
Can I use Java open Transaction Manager JOTM for this?
If yes can somebody point out to any tutorial
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Distributed transactions across multiple databases
 
It's not a secret anymore!