MySQL Forums
Forum List  »  Newbie

Re: mysql_ping before transaction commit
Posted by: Rick James
Date: March 14, 2009 09:15PM

The issue is thornier than that... If you lose connection during a transaction (after BEGIN, but before COMMIT), the transaction is aborted (ROLLBACK'd). The ping won't help.

You should test for errors after every statement, including COMMIT, and plan to do something if there is a failure. This might be as simple as re-executing the transaction.

The ping is useful if you sit idle so long that wait_timeout kicks in and drops your connection. Effectively it is a rude reminder that you should disconnect and reconnect rather than hogging a connection while doing nothing.

Would you like to elaborate on why you are considering the ping?

Options: ReplyQuote


Subject
Written By
Posted
P a
March 12, 2009 07:38AM
Re: mysql_ping before transaction commit
March 14, 2009 09:15PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.