aspose file tools
The moose likes JDBC and the fly likes commit and rollback in transaction Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "commit and rollback in transaction" Watch "commit and rollback in transaction" New topic
Author

commit and rollback in transaction

manishkumarlal cs
Greenhorn

Joined: Oct 25, 2005
Posts: 11
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 26184
    
  66

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.


[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
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: commit and rollback in transaction
 
Similar Threads
Hibernate not inserting new record on SQL Server
transaction.commit() is this necessary if we didn't do any data manipulation on database?
JTA - EJB container managed transaction
Hibernate@ oracle Express Edition (XE)
Rows not getting inserted: Hibernate