You sure can. You'll need to have the MySQL ODBC 3.51 Driver installed on the Window's machine, and your UNIX server will need to be set up to allow your IP address to connect. If you have cPanel, you can set up your IP as an 'Access Host'. If you don't, you may need to contact your provider. Here is some basic code:
Code:
lcServer="your_server_ip_address" && IP Address of server
lcDatabase="database_name"
lcUser = "user_name"
lcPassword = "password"
lcStringConn="Driver={MySQL ODBC 3.51 Driver}"+;
";Server="+lcServer+;
";Database="+lcDatabase+;
";Uid="+lcUser+;
";Pwd="+lcPassWord
*-- Don't prompt for login
SQLSETPROP(0,"DispLogin",3)
lnHandle=SQLSTRINGCONNECT(lcStringConn)
IF lnHandle > 0
*-- open connection, get the data, then close the connection
lcSQL = "SELECT * FROM sometable"
SQLEXEC(lnHandle, lcSQL ,"crTemp")
SQLDISCONNECT(lnHandle)
SELECT crTemp
LOCATE
BROWSE NORMAL NOWAIT
ELSE
=AERROR(laError)
MESSAGEBOX("Error at Connecting"+CHR(13)+;
"Description:"+laError[2])
ENDIF
I don't have VFP8 installed on my local PC, but I believe this should work just fine. The ability to connect to remote databases through SQL Passthrough has been around in VFP for a while! Let me know if you have any problems.
You can also check out
OpenTech. There is a forum called "Using VFP with MySQL" that could give you a lot more info. I also post mySQL and VFP related content on my blog.