Interesting...

Thanks for the info!


On Apr 19, 2007, at 8:53 PM, Ken Ray wrote:

On Thu, 19 Apr 2007 17:59:40 -0700, Josh Mellicker wrote:

If I revCloseDatabases() or resetAll and establish a new connection
before making any database command all is fine, but I am thinking
this is an inefficient approach... or is it?


So I am wondering if there is any clever way, perhaps through
checking sockets or other network wizardry, to verify a valid MySQL
database connection before actually executing a database command?

Well, the way we do it is to bundle mySQLAdmin with our app. Then,
whenever we are about to execute a DB command, we use the "ping"
command-line call to mySQLAdmin which should return "mysqld is alive".
If it doesn't, we respond with a Server Disconnected error, or
automatically go into a loop until the "ping" shows it's alive or a
certain timeout has expired. Here's the basic call to mysqladmin:

<pathToMySQLAdmin> --host=<IPAddress> --port=<port> -- user=<userName>
--password=<password> ping

as in (for Mac OS X):

put "/Users/kenray/Applications/MyApp/support/mysqladmin" into tAdmin
  put tAdmin && "--host=255.255.255.255 --port=3631 --user=ken
--password=password ping" into tCmd
  put shell(tCmd) into tResult
  return (tResult <> "mysqld is alive")

HTH,

Ken Ray
Sons of Thunder Software, Inc.
Email: [EMAIL PROTECTED]
Web Site: http://www.sonsothunder.com/
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to