aspose file tools*
The moose likes JDBC and the fly likes Approaches to roll back transactions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Approaches to roll back transactions " Watch "Approaches to roll back transactions " New topic
Author

Approaches to roll back transactions

Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270
Hi,

When I want to roll back a transaction I use this method:

conn.setAutoCommit( false );
....
if ( error )
conn.rollback();

The problem is that I use a mySQL database and have to convert the tables from myISAM to innoDB! I don�t like that, because it gives you some problem when making a copy of the database and open the new database, then all the innoDB tables can�t open again!

Because of that I will hear if there are other ways to make roll back transactions? What about executeBatch()?
[ April 10, 2005: Message edited by: Jeppe Fjord ]
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30749
    
156

Jeppe,
Take a look at XA drivers. They use two phase commit to roll back transactions across multiple databases.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270
MySQL does not support XA or JTA...(except mySQL 5.0)

(http://e-docs.bea.com/wls/docs90/jdbc_admin/third_party_drivers.html)
[ April 10, 2005: Message edited by: Jeppe Fjord ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Approaches to roll back transactions