• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

commit and rollback in transaction

 
manishkumarlal cs
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I need to execute a batch/transaction having a set of statements.I need to commit those statements which are executed successfully and the rest should be rolled back,is there any way to do it in java?

Manish
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34214
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Manish,
Yes. There is a feature called autoCommit. Normally, statements are set to commit automatically after each one is run. You can set this to false and then explicitly call commit/rollback. Take a look at the Connection object for these methods.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic