Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

manual transaction for all JDBC calls

 
Toby Davis
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
Adam Hardy
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Adam
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic