*
The moose likes JDBC 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
JavaRanch » Java Forums » Databases » JDBC
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: 19653
    
  18

Moving to JDBC.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 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
 
Similar Threads
How to use Java Transaction Service (JTS)
Java transaction service
Connecting to multiple databases using different jdbc drivers
Distributed Transaction
transaction in ejb vs jdbc