Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email email@example.com
From: Russell E Glaue (rglauecait.org)
Date: Mon Nov 05 2007 - 10:14:54 CST
Does the client loose the MySQL connection completely? Or is there just an error
in receiving the responding packet back?
Here is an idea:
You can do a ping to test the connection.
Fist ping the connection to verify you can send and receive on that connection.
Then send the SQL Command.
If you cannot ping the connection the first time, destroy the connection and
report "Connection lost to MySQL Server due to Network Errors."
If you get an errored network packet, then ping your connection a 2nd time to
test it to verify you still have the connection. Then report back to the client
"Network Error in receiving response from MySQL Server, your query may have been
successful, or maybe not."
If you get an errored network packet, and you cannot ping your connection a 2nd
time, then report back to the client, "Network connection lost, your query may
have been successful, or maybe not."
Does this happen more than 50% of the time?
If it does happen more than 50% of the time, you will want to add in more code
to test the connection every time, and verify the results of an SQL Command with
additional queries without relying only on the result MySQL sends back. This
will cost more on the client side.
If the client application is distributed to many users, you may want to set up a
flag to active this additional code, like "Turn on Paranoid MySQL Connections
with Follow Up Testing Methods"
NextWare - Mirko wrote:
> Hi All,
> I have this question...
> I send a INSERT from client to server, the server write the row and send
> the result "ok"
> to the client. Due to a network failure the client doesn't receive the
> result and an error is reported to the user.
> How can I manage this error?
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql