开发者

Delphi and mysql - Unable to connent to server..maybe custom connection reqd

I am coding an application for my company wherein i want to parse the results of a mysql query and display them 开发者_StackOverflow中文版in my application but i am facing a problem conecting to the database.

the ip address of the server is : 172.30.192.20 and before i can ping it i have to add route on my pc something like this

route add 172.30.192.0 mask 255.255.255.0 172.30.192.56

where 172.30.192.56 is the gateway

Now whenever i try to connect 172.30.192.20 which is where the sql server is running my appplication instead connects to 172.30.192.56

i am coding the application in delphi and have used TmySQL

After this didnt workout i tried an application called SQLwave. I just entered the server ip address and was able to connect to the database without any problems. it seems sqlwave uses mydac which is why even i tried using it but using the default connection options and setting i was still not able to connect. it seems sqlwave uses a custom connection using mydac

i just want to know whats going wrong with my connection


I tend to use the ADO Components. Here's a small (simple) example you may want to try...

Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=myDataBase; User=myUsername;Password=myPassword;Option=3;

Above is a Connection String, using the MySQL ODBC 5.1 driver (available on the MySQL website if you don't already have it). Modify this to reflect your server address, database name, username and password. Paste this into the "ConnectionString" property of a TADOQuery.

Set this ADOQuery object's SQL text to something like

SELECT * FROM mytable

Where "mytable" is the name of an existing table in your database.

Now change the ADOQuery object's Active property to True.... see what happens.

As Mason suggested, you may simply be experiencing a connectivity issue, still you never know, my method may come in handy!

Good luck!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜