简体   繁体   English

Delphi和UniDAC嵌入式MySQL连接字符串

[英]Delphi and UniDAC embedded MySQL connect string

I have a problem with connecting Devart UniDac with embedded mySQL database. 将Devart UniDac与嵌入式mySQL数据库连接时出现问题。

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? 但是我收到一些文件丢失的错误消息,我在./mysql/data/razrednici有数据库,我有一个共享文件夹以及数据文件夹和带有exe文件的libmysqld.dll ...缺少什么? 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. 要使用嵌入式服务器,应将所需的libmysqld.dll和“ Share”目录从MySQL服务器目录复制到应用程序所在的目录。

This library is different for 32-bit and 64-bit application and it is distributed with MySQL Server. 该库对于32位和64位应用程序是不同的,并且随MySQL Server一起分发。

The libmysqld.dll and share\\english\\errmsg.sys files are distributed with MySQL Server distribution of the corresponding bitness. libmysqld.dll和share \\ english \\ errmsg.sys文件与相应位数的MySQL Server分发一起分发。

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. 注意,MySQL Embedded Server库的32位和64位客户端库都称为同一个库-libmysqld.dll,并且每个库均以相应的位数进行分发。

It is enough to place libmysqld.dll in the same directory of the used file. 将libmysqld.dll放在使用的文件的同一目录中就足够了。

Also try to use in your sample the following code: 另外,请尝试在示例中使用以下代码:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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