Using java.sql and official oracle documentation does not state this explicitly but I feel like successive update queries do not update db automatically after using a method that performs a transaction using setAutoCommit(false)
, commit()
and rollback()
, do I have to call setAutoCommit(true)
after calling either commit()
or rollback()
?
CodePudding user response:
Changing the auto commit, will effect onl the active session, it will not revert to true after any command besides setAutoCommit(true)
So in short NO, you have to set it manually or reconnect, as it is set tppom true with every connection
CodePudding user response:
It's quite the opposite, if you think about it. If you call setAutoCommit(false)
, it means that commit is not called after you post the result of the query, and you need to call commit()
or rollback()
manually.
If there's not update in your database it means exatly that autoCommit is set to false!
If you feel that there's no update the meaning is that you started a transaction somewhere and forgot to call either commit or rollback, meaning that the transaction is still locking the records and the database cannot accept other modifications.
A session is a lock mechanism that prevents you to modify the database (or part of it, depending on how it was implemented) until the previous session hansn't ended!
My suggestion is to look for the place where you started a session but didn't end it either with commit()
or rollback()
. That's probably what is preventing furhter updates to be posted.