wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes JDBC performance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JDBC performance" Watch "JDBC performance" New topic
Author

JDBC performance

Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

Is it worth it to setAutoCommit off when I'm just doing a query ?
Pho


Regards,

Pho
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8898

If you have a series of statements to be executed then it is worth to setAutoCopmmit to off.. Otherwise each statement will be executed as a separate Tx.


Groovy
Mahesh Mamani
Ranch Hand

Joined: Jun 25, 2001
Posts: 110
Hi,
But execution of the setAutoCommit depends on the underlying driver classes used also...Some of the drivers just ignore the statement.

MSM
Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

Thanks for replying. I am using Oracle 8 thin driver and found this great resource n
benchmark results testing oracle drivers using setAutoCommit off and on. Interesting read.
Cheers.
Pho
Roger Thornhill
Author
Greenhorn

Joined: May 15, 2002
Posts: 25
In my opinion, you should almost never auto-commit. Implicit execution is generally bad, because it brings with it baggage that you don't often need. Auto-commit is safe for people unfamiliar with databases. But, for those who are comfortable with the basics, it really makes sense to commit explicitly and to perhaps commit sparingly (at some higher logical level).
For example, suppose you want to do an all-or-nothing insert of 100 rows. If one row fails, none of the other rows should be inserted. In that case, you should insert each of the rows without committing and then do the commit at the end. Not only will your batch processing work the way you want it to, but you will get much better performance.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC performance