Hi everybody.
I'm using MySQL server and ZEOS components (C++ Builder 2007) to connect to it. Because client is connecting to the server via internet, there is a possibility, that server can be ocasionally unreachable.
Is there any way how to chceck if server is available?
Thanks for help.
MySQL Server has gone away
Moderators: gto, cipto_kh, EgonHugeist
I do something similar to mdaems, only I make it a little more useful.
Instead of a simple ping, I attempt to update a "sessions" table with the IP, hostname, login name, time of day at the server, version number, Etc. of the user. I have the sessions table update method activate on a 30 second timer.
Use the workstation hostname as a primary key to sort things out, and use an "on duplicate key" clause to simply update on insert collisions.
If the session update fails, then you know you've lost the connection and can light up an LED, pop a warning dialog box or retry opening the connection.
Using this system, I can then monitor who is online at any given time. I use a grid that refreshes every 30 seconds on a timer. This grid can be in the application itself or in an administrators utility app.
Just look for session records newer than 30 seconds old and display them in the sessions grid.
It comes in handy if I need to kick everyone off the server for maintenance. Its easier than using the MySQL Admin utility, since the session-watcher grid is application-specific and can include other user information.
Last, I can see in the session table who hasn't been online in weeks and review their access privs to the system.
HTH!
Kevin G. McCoy
Instead of a simple ping, I attempt to update a "sessions" table with the IP, hostname, login name, time of day at the server, version number, Etc. of the user. I have the sessions table update method activate on a 30 second timer.
Use the workstation hostname as a primary key to sort things out, and use an "on duplicate key" clause to simply update on insert collisions.
If the session update fails, then you know you've lost the connection and can light up an LED, pop a warning dialog box or retry opening the connection.
Using this system, I can then monitor who is online at any given time. I use a grid that refreshes every 30 seconds on a timer. This grid can be in the application itself or in an administrators utility app.
Just look for session records newer than 30 seconds old and display them in the sessions grid.
It comes in handy if I need to kick everyone off the server for maintenance. Its easier than using the MySQL Admin utility, since the session-watcher grid is application-specific and can include other user information.
Last, I can see in the session table who hasn't been online in weeks and review their access privs to the system.
HTH!
Kevin G. McCoy