Mysql connection to Delphi6

Asked

Viewed 83 times

0

I need to make database connection MySQL using DELPHI6. Someone has a solution?

  • An alternative that works very well with Mysql is the ZEOSLIB library

2 answers

1

Add the components below:

Tsqlconnection Tsqldataset Tdatasetprovider Tclientdataset Tdatasource

The first two are found in the dbExpress palette, the others in the Data Access palette.

To start, we took the Tsqlconnection component and in the Driver property, we selected Mysql. We open the Params property and change the following fields:

Hostname: The BD address is usually mysql.seusite.com.br; Database: The name of the database created; User_name: The user created to access the database; Password: The password created to access the database.

That done, in the last property of Tsqlconnection, we have the option Vendorlib, which is marked libmysql.dll. Here was my big problem. This dll should be in the system32 folder of windows, but as I use Windows 7 64bits, it should be in the Syswow64 folder. After playing it, it worked. So if you use Windows 64bits, copy this dll to Syswow64 folder.

After that, just go to the Tsqldataset component, the Sqlconnection property and select your Tsqlconnection. In the Commandtext property, type any sql command, e.g. Select * Table and put the Active property to True.

In Tdatasetprovider, select your Tsqldataset in the Dataset property.

In Tclientdataset, select your Tdatasetprovider in the Providername property and place the Active property to True.

Finally, in your Tdatasource, select your Tclientdataset in the Dataset property.

source: http://www.aerstudio.com.br/blog/programacao/delphi/conectar-delphi-com-mysql-na-web/

0

Browser other questions tagged

You are not signed in. Login or sign up in order to post.