This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Transaction processing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Transaction processing" Watch "Transaction processing" New topic

Transaction processing

Richard Robbins
Ranch Hand

Joined: Mar 07, 2001
Posts: 66
My current method for doing transactions is to set the auto commit property to false when doing an executeUpdate. I then use commit() when the transaction is completed and rollback() when necessary. Is there an alternative (and better) way to accomplish transactions?

Richard Robbins is one of the founders of, a resource for free website templates and Photoshop tutorials. He also consults for an online boutique selling baptism dresses and christening gowns.

Joined: Aug 01, 2000
Posts: 7
YEs, there is another way to do this also. Your method is perfect. But when the session is timedout then and if you are doing some transaction in the databse, you may not store the proper data in the database. For this purpose use HttpSessionBindingListener to wrap yoour connection object wqith the session. Whenever the session is timed out then your corresponding ValueUnbound method will be called in which you can roll back or whatever you want to do , you can do it before rollingback or doing some stuff.
Hope this answerrs your question.
Thanks & Regards,

Thanks & Regards,<br />Murthy
I agree. Here's the link:
subject: Transaction processing
It's not a secret anymore!