Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: Connect to MySql

$
0
0
Re: Connect to MySql
Web Connection 5.0
Re: Connect to MySql
10/13/2012
01:42:06 PM
3MB0TDCM2 Show this entire thread in new window
Gratar Image based on email address
From:
Rick Strahl
To:
Attachments:
None

You can also use wwSql to do the same thing which is a little bit easier than raw SQL Passthrough (it still uses SQL Passthrough) but caches the connection ID and provides you an object rather than a connection handle.


cMyIPServeur="xxx.xxx.xxx.xxx" && the IP adress for the MYSQL server to use cMyDatabase="MyDataSQL" && the name of the MYSQL database to connect cMyUser="luca" && the login of the user to connect the cMyDatabase cMyPassWord="xxxxxx" && the password of the user to connect the cMyDatabase cMYConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" "SERVER="+m.cMyIpServer+";" "DATABASE="+m.cMyDatabase+";" "USER="+m.cMyUser+";" "PASSWORD="+"m.cMyPassword";" "OPTION=3;" SET CLASSLIB to wwSQL Additive loSql = CREATEOBJECT("wwSql") loSql.Connect(cMyConnectionString) lcCompany = "West Wind" lnCount = loSql.Execute("select * from customers where company=?lcCompany") lcCompany = "East Wind" ldUpdate = DateTime() lnCount = loSql.ExecuteNonQuery("insert into Customers (company,updated) values (lcCompany,ldUpdated))

One nice thing is that wwSQL provides error handling and manages the connection for you. It's optimized for SQL Server but works with any ODBC connection including MySql.

+++ Rick ---



Hi,
thank you very much again for fast and detailed reply :)
I should develop a web management tool on a Windows server to connect to other MySql Linux servers to retrieve updated data from their databases. I know how to develop web application with West Wind Web Connection, but I have no experience to connect to other database than FoxPro.
So I should ask them:
IP address of MySql servers
usernames
passwords

Do Linux administrators have to enable something on their databases to allow connection from an external procedure?

Sincerely


Hi Luca
If you have installed on your PC the ODBC driver for MySQl you must do for example:

LOCAL cMyIpServer AS STRING, cMyDatabase AS STRING, cMyUser AS STRING, cMyPassWord AS STRING, cMyConnexionString AS STRING, cAction AS STRING, iReturn AS INTEGER, cLocalCursor AS STRING PUBLIC iMyIdConnection AS INTEGER m.cMyIPServeur="xxx.xxx.xxx.xxx" && the IP adress for the MYSQL server to use m.cMyDatabase="MyDataSQL" && the name of the MYSQL database to connect m.cMyUser="luca" && the login of the user to connect the cMyDatabase m.cMyPassWord="xxxxxx" && the password of the user to connect the cMyDatabase m.cMYConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" &&Connection string to use to connect to MySQL with 3.51 ODBC DRIVER "SERVER="+m.cMyIpServer+";" "DATABASE="+m.cMyDatabase+";" "USER="+m.cMyUser+";" "PASSWORD="+"m.cMyPassword";" "OPTION=3;" * Connection to MySQL m.iMyIdConnection=SQLSTRINGCONNECT(m.cMYConnectionString,.T.) m.cAction="SELECT col1, col2,colx FROM tablex WHERE col5="luca" ORDER BY 2" m.cLocalCursor="cMySQLResult" m.iReturn=SQLEXEC(m.iMyIdConnection,m.cAction,m.cLocalCursor) IF m.iReturn>0 BROWSE ENDIF USE IN SELECT(m.cLocalCursor) * Disconnection of MYSQL =SQLDISCONNECT(m.iMyIDConnection)

Best regards


dear friends,
I need to connect to a MySql database through web only to read tables.
The MySql database is hosted on Linux and I have to make (possibly) an automatic procedure connecting to database from web, executing some query, then disconnectig.
Please, what is the procedure to connection?
Please, is it possible? How to connect from web?
Thank you very much





Rick Strahl
West Wind Technologies

Making waves on the Web

from Maui, Hawaii
HTML Help Builder

Viewing all articles
Browse latest Browse all 10393

Trending Articles