Hi to all,
My hosting company allowed me using SSH-protocol in order to update MySQL database on their host from VFP app on client computers. I picked Putty free application for setup SSH, and for this task I need only IP of host, port and username with password, no need for public or private key. I made a command line and put all necessary parameters for connection into *.bat file that after run made connection. Voila. Afer that I started Navicat and after setting correct parameters for connection I got hosting database right into Navicat window, what is proof that's working, right? But until my program code with local MySQL running under Win on same PC where is VFP is working great, I was unable to make connection to hosting MySQL and get data from any table! I'm now confuse shall I use name server as localhost, or IP-address of host, what is with port (3306 or a one I got from administrator for SSH..? Is here anybody that is willing to help me? Thanks.
There is no good nor evil, just decisions and consequences.
My hosting company allowed me using SSH-protocol in order to update MySQL database on their host from VFP app on client computers. I picked Putty free application for setup SSH, and for this task I need only IP of host, port and username with password, no need for public or private key. I made a command line and put all necessary parameters for connection into *.bat file that after run made connection. Voila. Afer that I started Navicat and after setting correct parameters for connection I got hosting database right into Navicat window, what is proof that's working, right? But until my program code with local MySQL running under Win on same PC where is VFP is working great, I was unable to make connection to hosting MySQL and get data from any table! I'm now confuse shall I use name server as localhost, or IP-address of host, what is with port (3306 or a one I got from administrator for SSH..? Is here anybody that is willing to help me? Thanks.
Code:
lcServer="localhost"
lcPort= 3306
lcDatabase="mydatabase"
lcUser="myname"
lcPassword="mypassw"
lcStringConn="Driver={MySQL ODBC 3.51 Driver};Server=&lcServer;Port=lcPort;Option=16384;Stmt=;Database=&lcDatabase;Uid=&lcUser;Pwd=&lcPassword"
SQLSETPROP(0,"DispLogin",1)
lnHandle=SQLSTRINGCONNECT(lcStringConn)
upit="select * from table1"
IF lnHandle > 0
rez=SQLEXEC(lnHandle, upit, "ctable1")
browse
ELSE
*error description
endif
=SQLDISCONNECT(lnHandle)
There is no good nor evil, just decisions and consequences.