943,972 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 6250
  • Java RSS
Nov 17th, 2006
0

if do not setAutocommit(true)

Expand Post »
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......
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
rpjanaka is offline Offline
69 posts
since Sep 2006
Nov 17th, 2006
0

Re: if do not setAutocommit(true)

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.
Moderator
Reputation Points: 1471
Solved Threads: 490
Industrious Poster
masijade is offline Offline
4,043 posts
since Feb 2006
Nov 18th, 2006
0

Re: if do not setAutocommit(true)

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.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: For Statement Advise
Next Thread in Java Forum Timeline: RP Battle Simulator





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC