File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Regarding autoCommit() Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Regarding autoCommit()" Watch "Regarding autoCommit()" New topic
Author

Regarding autoCommit()

Sajee Joseph
Ranch Hand

Joined: Jan 17, 2001
Posts: 200
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
Jason Cox
Ranch Hand

Joined: Jan 21, 2004
Posts: 287
Depends on what you are trying to do. If the connection is closed, then the next connection you open will likely have autoCommit set to 'true'. In which case you'll have to set it to false upon each opening of a new connection.
However, you should only need to set autoCommit back to true if the connection is still open and you're doing additional processing with it where you want it to autoCommit. Can't think of any examples personally since I pretty much set it to autoCommit false and leave it that way.


<a href="http://www.unfetteredblather.com" target="_blank" rel="nofollow">Unfettered Blather</a> - Updated daily nonsense
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Regarding autoCommit()
 
Similar Threads
how to configure autocommit in Webshpere application server
storing date in mysql
How can i close a connection to Access97?
Is there a begintrans in Java?
Auto commit???