List:General Discussion« Previous MessageNext Message »
From:Lefteris Tsintjelis Date:October 16 2005 9:41am
Subject:Re: Connectivity problem (?), mysql_ping ()
View as plain text  
I did some extensive testing and it looks like that only the first
mysql_ping () fails to reconnect or very possibly returns the wrong
result. I am currently using v4.1.14.

Regards,

Lefteris

----------------------------------------------------
Begin
MySQL is up and running
Restart MySQL and hit enter (reconnect: 1)...

Error: Lost connection to MySQL server during query
Ping 2 Ok!
Ping 3 Ok!
----------------------------------------------------
#include <stdio.h>
#include <mysql.h>

int main ()
{
         int i;
         char c;
         MYSQL mysql;

         fprintf (stdout, "Begin\n");
         mysql_init (&mysql);
         if (!mysql_real_connect (&mysql, "127.0.0.1", "root", "", "test", 0, NULL,
0))
                 fprintf (stderr, "Failed to connect to database: Error: %s\n",
mysql_error (&mysql));
         else
                 fprintf (stdout, "MySQL is up and running\n");
         mysql.reconnect = 1;
         fprintf (stdout, "Restart MySQL and hit enter (reconnect: %d)...",
mysql.reconnect);
         c = getchar ();
         (void) putc ('\n', stdout);
         for (i = 1; i < 4; i++)
                 if (mysql_ping (&mysql))
                         fprintf (stderr, "Error: %s\n", mysql_error(&mysql));
                 else
                         fprintf (stdout, "Ping %d Ok!\n", i);
         return (0);
}
Thread
Connectivity problem (?), mysql_ping ()Lefteris Tsintjelis15 Oct
  • Re: Connectivity problem (?), mysql_ping ()Gleb Paharenko15 Oct
    • Re: Connectivity problem (?), mysql_ping ()Lefteris Tsintjelis15 Oct
    • Re: Connectivity problem (?), mysql_ping ()Lefteris Tsintjelis16 Oct
      • Re: Connectivity problem (?), mysql_ping ()Gleb Paharenko16 Oct
        • Re: Connectivity problem (?), mysql_ping ()Lefteris Tsintjelis16 Oct