if do not setAutocommit(true)

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Sep 2006
Posts: 68
Reputation: rpjanaka is an unknown quantity at this point 
Solved Threads: 0
rpjanaka rpjanaka is offline Offline
Junior Poster in Training

if do not setAutocommit(true)

 
0
  #1
Nov 17th, 2006
hi

i want to know what happen if we do not "setAutocommit(true)" after a transaction..


at the begining of the transaction it is "setAutocommit(false)";

but then at the end of the transaction if i do not setAutocommit(true), is that will affected for the anoter transaction comming next....?

please help me......
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,467
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 267
Moderator
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven

Re: if do not setAutocommit(true)

 
0
  #2
Nov 17th, 2006
That depends. If you use the same connection, then, obviously, autocommit will still be deactivated. If you close the question and get a new one for the next transaction (without Connection Pooling) then autocommit will be activated on the next transaction (unless you deactivate it again). If you use connection pooling, it depends on what your connection pooling "agent" does. Some of these tools will actually close the connection and immediately reopen a new one and return that to the pool. Some will simply clean the connections up and recycle the same connection. And some will do none of the above. They are all suppossed to return a connection that acts as one freshly opened, so aurocommit shopuld be active (but I would not trust this). In any case, when in doubt, set autocommit manually before every transaction block.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: if do not setAutocommit(true)

 
0
  #3
Nov 18th, 2006
Whether it does anything at all also depends on the database settings.
It could well be that the database is set to not support autocommit for example, requiring an explicit commit or rollback.
Personally I consider that to be the best option in most real applications, as it gives more control over transaction handling (and probably higher performance) than having an implicit commit on every insert or update.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum


Views: 3789 | Replies: 2
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC