Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the result when calling BEGIN TRANS, but not COMMIT, ROLLBACK, or END TRANS?

In explicit transaction, if i start the transaction by giving BEGIN TRANS but if i dont give COMMIT,ROLLBACK or END TRANS then what will happen to the application?

like image 626
savitha Avatar asked Jan 21 '26 04:01

savitha


2 Answers

nothing - the transaction is still on-going. If you terminate the connection, it is rolled-back.

like image 199
Hafthor Avatar answered Jan 22 '26 16:01

Hafthor


Because your transaction may lock parts of the database, you may cause other transactions/queries to block until you do issue one of those commands.

At some point, one way or another, the transaction has to be completed. When something goes 'wrong' (eg application ended), it will be rolled back, unless you commit it first.

like image 41
Nader Shirazie Avatar answered Jan 22 '26 16:01

Nader Shirazie