Showing posts with label autocommit. Show all posts
Showing posts with label autocommit. Show all posts

Saturday, 9 November 2019

Setting up a database and have auto-commit turned off

Q: You are working on setting up a database and have auto-commit turned off so you can easily undo mistakes. Unfortunately, your session crashes – the database itself is fine but your remote connection failed due to network troubles. You are disconnected long enough for your mysql session to terminate.
Once you manage to reconnect and start a new session, what happens to the changes that you made since your last manual commit (or entry of a statement equivalent to a commit) and why? Select the best answer.
You may want to read up the details.


1.
Because auto-commit is turned off, you have lost all of your work since you last manually committed your work. Any changes made since then have been rolled back.
2.
You will not have lost any work, because MySQL sessions automatically continue from where they left off last time. Any uncommitted work is still not committed.
3.
Whether or not you lost work depends on the type of commands in the current transaction. Actions less likely to interfere with another transaction are more likely to have been accepted.
4.
You will not have lost any work, because the end of a session acts as a commit.


Solution:
Option 4
Because a commit or rollback command will ends the current session and starts a new one