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
 

1 comment:

  1. No offense but I highly recommend you to have your posts moved into a WordPress website. I just read some of your articles and they are actually good but I can see they dont receive as much love as I would like to see when reading this website...just my opinion.

    ReplyDelete