Unit-5 SQL 4.1 TRANSACTIONS
Unit-5 SQL 4.1 TRANSACTIONS
To view the current autocommit setting, type the following in the MySQL shell:
As you can see, the @@autocommit system variable is set to 1 which means that the
autocommit mode is enabled.
If you disable the autocommit mode then the SQL statements that follow will be part of a
transaction, and you will have to commit them manually using the COMMIT statement before the
MySQL session ends, otherwise, the changes made by the statements will be rolled back.
MYSQL TRANSACTIONS
CLOSING A CONNECTION
OUTPUT
We placed all our code in the “try-except” block to
:
catch the database exceptions that may occur
during the process.
PRACTICAL IMPLEMENTATION:18
PRACTICAL IMPLEMENTATION:18