• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding autoCommit()

 
Sajee Joseph
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
In my servlet application, i have an setAutoCommit(false) statement. I use this to control the commits & rollbacks. is it necessary to set back the autoCommit to true after the commit or rollback is done?
Thanks,
Sajee
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have other logic that you want to be comitted automatically, I would say yes.
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sajee Joseph:
is it necessary to set back the autoCommit to true after the commit or rollback is done?

I guess to avoid underiable outcome with the buffer, u have to set it back to autocommit to true... It's better to accept the default implementation of the API, if you don't need to deal with special things on it...
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Strictly, you should check that it isn't already set to false before you really set it, and only set it "back" to true if it was true before your code.
You can get yourself in some really sticky situations if you set something "back" to what it wasn't!
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the JDBC forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic