The MySQL server is localhost. As for checking if the query was successful or not, this was the check, and that was the result of the failure.
if (mysql_query(&mysql,sqlcmd)) logger("[sql] %s\n%s \n\n",sqlcmd,mysql_error(&mysql)); sqlcmd is the query If the query fails logger() is executed which logs the query and the failure.. mysql_error(&mysql) is the reason why it failed. The query failed with the result(error) "Lost connection to MySQL server during query" If it passed logger() would never be called on. The failed queries I have to manually insert into the database, the syntax is fine. It's maybe only 1 query in every 1,000 that fails. But when the daemon inserts 50,000 queries a day over a week that's a fair bit of failures which I can not put up with. Just trying to figure out if I have to write a second function to re-connect and retry to insert the failed query or does the mysql api automatically reconnect and insert the failed query. Id assume it automatically reconnects considering other queries after the failed ones work fine without error. Thanks for those suggestions David. Regards, Benjamin Charles Tehan > Is MySQL located on the same computer your script/software is running on..?? > Another option to prevent these mistakes is to always check if a query was > succesfully executed.. > Regards, > David > > > I'm using MySQL 3.23.43 running on Linux with a 2.2.16 kernel. > > > > My software does around 50,000 inserts a day and from some of those inserts > > they result in: > > > > Lost connection to MySQL server during query > > > > The software is developed in C, using the mysql C api to talk to the > > database. > > > > Problem is.. once I get this error I'd assume I have lost connection to the > > database and that I would need to reconnect and try to insert the query > > again. > > > > For this instance I DO NOT reconnect to the database and the application > > continues to make more queries to the database but they work fine even after > > I get the above result from the queries I had made before. > > > > Does the MySQL C API automatically reconnect when a connection is lost? > > If so does it try to execute the query again once it has reconnected to the > > database? > > > > If it doesn't automatically reconnect then why am I getting this error when > > the application really has not lost connection with the database. > > Considering it can succesfully insert queries after the above result.. > > > > Any help would be appreciated. > > > > Regards, > > > > Benjamin Charles Tehan --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php