File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Transaction processing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Transaction processing" Watch "Transaction processing" New topic
Author

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 WebsiteTemplateDatabase.com, a resource for free website templates and Photoshop tutorials. He also consults for an online boutique selling baptism dresses and christening gowns.
asnmurthy
Greenhorn

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.
Regards,
Murthy
A.Murthy@gecapital.com
------------------
Thanks & Regards,
Murthy


Thanks & Regards,<br />Murthy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Transaction processing