Kairan
Kairan

Reputation: 5542

How does Oracle handle SQL when autocommit=false and there is no commit or rollback?

I am running Java and Oracle SQL 11g.

What happens if you establish a connection to a database, setting the connection to AutoCommit=False but you have neither a commit() nor a rollback() ?

I have my code wrapped in a try/catch/finally and in the finally I have a rollback. However, I noticed that I am missing two records from a table. My assumption is that I was in my code in debug mode and clicked the stop button so it didnt reach the rollback command, nor does it have a commit anywhere in between.

Upvotes: 0

Views: 379

Answers (1)

Justin Cave
Justin Cave

Reputation: 231671

If you have neither a commit nor a rollback, the transaction would remain open waiting for you to issue one or the other. If you tried to close the Connection object the results are implementation-dependent. Your transaction might be committed, it might be rolled back.

Upvotes: 1

Related Questions