Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Carlos Alloatti
  Where is Carlos Alloatti?
 
 Argentina
 Carlos Alloatti
 To: Jorrel Detaunan
  Where is Jorrel Detaunan?
 Las Piñas
 Philippines
 Jorrel Detaunan
 Tags
Subject: RE: VFP9 Ping, MySql ODBC Driver
Thread ID: 181730 Message ID: 182083 # Views: 50 # Ratings: 0
Version: Visual FoxPro 9 Category: Network and Computer Management
Date: Monday, July 07, 2008 2:59:32 PM         
   


> 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



COMPLETE THREAD
VFP9 Ping, MySql ODBC Driver Posted by Jorrel Detaunan @ 7/5/2008 4:08:22 AM
RE: VFP9 Ping, MySql ODBC Driver Posted by Lyrad Bangoy @ 7/5/2008 4:38:24 AM
RE: VFP9 Ping, MySql ODBC Driver Posted by Eric den Doop @ 7/5/2008 7:56:26 AM
RE: VFP9 Ping, MySql ODBC Driver Posted by Lyrad Bangoy @ 7/5/2008 8:13:14 AM
RE: VFP9 Ping, MySql ODBC Driver Posted by Carlos Alloatti @ 7/7/2008 2:59:32 PM
RE: VFP9 Ping, MySql ODBC Driver Posted by Jorrel Detaunan @ 7/8/2008 3:43:57 AM
RE: VFP9 Ping, MySql ODBC Driver Posted by Pete Sass @ 7/7/2008 5:13:01 PM
RE: VFP9 Ping, MySql ODBC Driver Posted by Jorrel Detaunan @ 7/8/2008 3:45:47 AM
RE: VFP9 Ping, MySql ODBC Driver Posted by Patrick McGreevy @ 7/12/2008 4:39:33 AM
RE: VFP9 Ping, MySql ODBC Driver Posted by Pete Sass @ 7/16/2008 7:39:25 PM