2
votes

I have a question about Oracle autocommit on close connection event.

Information from oracle docs(http://docs.oracle.com/cd/E16655_01/java.121/e17657.pdf):

If the auto-commit mode is disabled and you close the connection without explicitly committing or rolling back your last changes, then an implicit COMMIT operation is run.

So, I want to disable this feature programmatically in JDBC driver. I don't wan't do autocommit on connection close at least one transaction. Is it possible?

P.S. setAutoCommit change JDBC action. "Auto_Commit" start new transaction and call commit on every statement. It is not solution for my problem.

2

2 Answers

0
votes

EDIT. Possible duplicate : Does Java Connection.close rollback?

According to the javadoc, you should try to either commit or roll back before calling the close method. The results otherwise are implementation-defined.

-1
votes

You can have a look at the setAutoCommit() method of the Connection class. More details here