• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDBC performance

 
Ranch Hand
Posts: 782
Python Chrome Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it worth it to setAutoCommit off when I'm just doing a query ?
Pho
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 782
Python Chrome Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Author
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic