Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

commit and rollback in transaction  RSS feed

 
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
 
author & internet detective
Marshal
Posts: 37714
579
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
Boost this thread!