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......

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.