| | |
if do not setAutocommit(true)
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Sep 2006
Posts: 68
Reputation:
Solved Threads: 0
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......
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......
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
----------------------------------------------
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
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.
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.
![]() |
Similar Threads
- Monitor not doing true color anymore (Windows 95 / 98 / Me)
- help getting !true bool to break out of program (C++)
- Antec True Power 430 Watt PSU (Cases, Fans and Power Supplies)
- Microsoft Changes The Game Plan: Windows 2003 A True NOS? (Windows NT / 2000 / XP)
- cant use acronis true image on windows xp (Windows NT / 2000 / XP)
Other Threads in the Java Forum
- Previous Thread: For Statement Advise
- Next Thread: RP Battle Simulator
Views: 3789 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for Java
3d @param affinetransform android api apple applet application arc arguments array arrays automation binary bluetooth byte c# chat class classes click client code color compare component corrupted database detection draw eclipse error event exception file fractal game givemetehcodez graphics gui guitesting helpwithhomework html ide image input integer j2me java java.xls javaprojects jmf jni jpanel julia keytool linux list loop map method methods mobile netbeans newbie number object oracle pong print problem producer program programming project projectideas read recursion reflection replaysolutions rim scanner screen server set size sms socket sort sql string swing terminal test threads time transfer tree web windows






