> Hello there! Can someone help me about pinging an ip address? im using MySQL as my backend but everytime the server is down, the MySQL ODBC connection settings always pop up. If i could just ping the ip address on the first place i could control the errors occuring. Or maybe to add additional control in the connection string to block the pop-up window.
>
> and one more thing... how can i check if the server is still active? Ex: I am connected to the server and suddenly the connetion broke.
>
> Thank you...
You can "ping" the MySql server with this code:
*!* Start of program:
Declare Integer mysql_init In c:\mysql\bin\libmySQL.Dll ;
Integer mysql
Declare Integer mysql_real_connect In c:\mysql\bin\libmySQL.Dll ;
Integer mysql, ;
String Host, ;
String User, ;
String passwd, ;
String db, ;
Integer port, ;
String unix_socket, ;
Integer client_flag
Declare Integer mysql_ping In c:\mysql\bin\libmySQL.Dll ;
Integer mysql
Declare mysql_close In c:\mysql\bin\libmySQL.Dll ;
Integer mysql
m.lcHost = "127.0.0.1"
m.lcUser = "root"
m.lcPasswd = "12345678"
m.lcDb = .Null.
m.lnPort = 0
m.lcUnixSocket = .Null.
m.lnClientFlag = 0
m.lcmysql = mysql_init(0)
?mysql_real_connect(m.lcmysql, m.lcHost, m.lcUser, m.lcPasswd, m.lcDb, m.lnPort, m.lcUnixSocket, m.lnClientFlag)
*!* To check is server is there:
?mysql_ping(m.lcmysql)
*!* This at end of program
mysql_close(m.lcmysql)
I have tried with no luck to use the underlying ODBC handle you get with SqlGetProp("ODBChdbc") in the call to mysql_ping. The API call fails.
Carlos Alloatti