File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes manual transaction for all JDBC calls 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 "manual transaction for all JDBC calls" Watch "manual transaction for all JDBC calls" New topic

manual transaction for all JDBC calls

Toby Davis
Ranch Hand

Joined: Apr 09, 2002
Posts: 65
For consistency, I usually have autocommit set to false for all my JDBC calls. I know when it's necessary to have for complex transactions, such as multiple batch queries, insert/update/delete calls and so forth.
Is there any performance hit or other issues using manual transactions for single calls (see example below)?
Simple example:

SCJP2 (1.4)
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 567
There's no performance hit - in fact if you save up your commits until the end of all the db calls, you can get a performance gain, since you only do one commit, compared to autocommit which does a commit for every statement.


I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: manual transaction for all JDBC calls
It's not a secret anymore!