Here is the sequence of events that my hypothetical program does ...
- Open a connection to the server.
- Run the UPDATE command.
- Go away and do something that can take a considerable amount of time.
- Run another UPDATE, which changes the change in step 2.
- Close the connection.
But oh no! During step 3, the machine running this program literally exploded. Other machines requesting the same database will now think that the exploded machine is still working and is doing something.
What I would like to do is like opening a connection, but before any changes are made, tell the server that this connection must be closed for some reason in order to run some SQL. That way, I can be sure that if something goes wrong, the closure update will happen.
(To warn the answer, I am not looking for locking tables and records or transactions. I am not claiming resources here).
Thanks a lot, billpg.
source
share