简体   繁体   中英

Delphi and UniDAC embedded MySQL connect string

I have a problem with connecting Devart UniDac with embedded mySQL database.

The code goes:

basedir := GetCurrentDir + '\mysql';
UniConnection1.ProviderName := 'MySQL';
UniConnection1.Database := 'razrednici';
UniConnection1.SpecificOptions.Values['Embedded'] := 'True';
UniConnection1.SpecificOptions.Values['EmbeddedParams'] := '--basedir=' +
  basedir + ''#13#10'--datadir=data';
UniConnection1.Connect;

but i get an error message of some files missing, i have the database in ./mysql/data/razrednici i have a share folder along with data folder and libmysqld.dll with the exe file... what is missing? help me out

To work with the Embedded server you should copy the required libmysqld.dll and the "Share" directory from the MySQL server directory to the directory with your application.

This library is different for 32-bit and 64-bit application and it is distributed with MySQL Server.

The libmysqld.dll and share\\english\\errmsg.sys files are distributed with MySQL Server distribution of the corresponding bitness.

Note, both 32-bit and 64-bit client libraries of the MySQL Embedded Server library are called the same - libmysqld.dll and each of them is distributed with the distribution of the corresponding bitness.

It is enough to place libmysqld.dll in the same directory of the used file.

Also try to use in your sample the following code:

 UniConnection.SpecificOptions.Values['EmbeddedParams'] := '--basedir=.'#13#10'--datadir=data'; 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM