Delphi XE2 dbExpress MySQL 连接

发布于 2024-12-06 14:35:16 字数 515 浏览 3 评论 0原文

无论我尝试什么,我都无法让 XE2 使用 dbExpress 连接到 MySQL。这个问题实际上有很多方面。首先,目标MySQL是32位或64位,这会影响MySQL安装附带的libmysql.dll,这似乎具有误导性,因为XE2 IDE是32位应用程序,它只接受32位DLL。所以我需要使用32位安装libmysql.dll,将其放在Windows\System32下(或者到项目本身的文件夹中),然后在我的项目中将Target编译平台设置为32位(这样就不会尝试使用 64 位 dbxmys.dll,以防万一),但仍然没有运气。我尝试的所有组合都会出现此错误:“DBX 错误:驱动程序无法正确初始化。客户端库可能丢失......”

任何人都能够使 XE2 dbExpress 连接到 MySQL 服务器吗?我需要你的帮助。提前致谢。

Windows 7 64 位(使用 XE2 的开发平台)、MySQL 5.5.16 32 位(安装在远程 XP 32 位上)/MySQL 5.1.54 64 位(安装在远程 XP x64 上)(都尝试过,通过使用他们的 libmysql.dll)

No matter what I've tried, I couldn't make XE2 to connect to a MySQL with dbExpress. The problem has actually many faces. First, target MySQL is either 32- or 64-bits, which affects the libmysql.dll that comes with the MySQL installation, which seems to be misleading because XE2 IDE is a 32-bit application and it only accepts 32-bit DLLs. So I needed to use a 32-bit installation libmysql.dll, put it under Windows\System32 (or to the project's folder itself), and then set the Target compile platform to 32-bit in my project (so that it won't try to use 64-bit dbxmys.dll, just in case), still with no luck. All the combinations I tried resulted with this error: "DBX Error: Driver could not be properly initialized. Client library may be missing......."

Anyone who's able to make XE2 dbExpress connect to a MySQL server? I need your help. Thanks in advance.

Windows 7 64-bit (dev platform with XE2), MySQL 5.5.16 32-bit (installed on a remote XP 32-bit) / MySQL 5.1.54 64-bit (installed on a remote XP x64) (tried with both, by using their libmysql.dlls)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

夜清冷一曲。 2024-12-13 14:35:16

你的问题的答案很简单,安装你的mysql并从你的mysql bin复制libmysql.dll,如图所示。(C:\Program Files\MySQL\MySQL Server 5.1\bin)然后转到xe2目录并打开bin例如(C:\ Program Files \ Embarcadero \ RAD Studio \ 9.0 \ bin)并将其粘贴到那里运行已经存在的libmysql.dll。

the answer to your question is simple, install your mysql and copy libmysql.dll from your mysql bin as shown eg.(C:\Program Files\MySQL\MySQL Server 5.1\bin) and then go to the xe2 directory and open the bin too eg (C:\Program Files\Embarcadero\RAD Studio\9.0\bin) and paste it there over running the already libmysql.dll in it.

小霸王臭丫头 2024-12-13 14:35:16

由于您似乎使用的是 x64 Windows,因此您应该将 x32 libmysql.dll 放入 Windows\SysWOW64,而不是 Windows\System32 中。或者您可以将 x32 libmysql.dll 放入 XE2\Bin 文件夹中。

如果您要构建 x64 应用程序,则应将 x64 libmysql.dll 放入 Windows\System32 或 EXE 文件夹中。

As it seems you have x64 Windows, then you should put x32 libmysql.dll not into Windows\System32, but into Windows\SysWOW64. Or you can put x32 libmysql.dll into XE2\Bin folder.

If you will build x64 application, then x64 libmysql.dll you should put into Windows\System32 or into your EXE folder.

扛起拖把扫天下 2024-12-13 14:35:16

这个问题的答案可以在 WiltonSoftware.com

我所做的是:

  1. 我下载了包含 libmysql.dll 版本 5.1.59 的 zip 文件
  2. 我创建了文件夹 C:\Program Files (x86)\MySQL\MySQL Connector 5.1.59\lib
  3. 我将 DLL 复制到刚刚创建的文件夹
  4. 我在 Windows Path 环境变量中添加了该文件夹,

它对我来说工作得很好!

The answer for this question is found at WiltonSoftware.com.

What I did was:

  1. I downloaded the a zip file containing libmysql.dll version 5.1.59
  2. I created the folder C:\Program Files (x86)\MySQL\MySQL Connector 5.1.59\lib
  3. I copied the DLL to the just created folder
  4. I added that folder in the Windows Path environment variable

It worked fine to me!

人│生佛魔见 2024-12-13 14:35:16

有点晚了,但我希望它有帮助:

  1. 安装 Delphi XE2 的最新更新
  2. 安装 SQL Server 2008 本机客户端
  3. 卸载所有旧的东西,如 SQL Server Express 2005(如果已安装)

我无法查明其工作的确切原因。可能是使用 sqlncli.dll 而不是 oledb.dll。

A bit late, but I hope it helps:

  1. Install the latest Updates for Delphi XE2
  2. Install SQL Server 2008 native client
  3. Uninstall everything old like SQL Server Express 2005 (if installed)

I was not able to pinpoint the exact reason why this works. Could be the usage of sqlncli.dll instead of oledb.dll.

笑着哭最痛 2024-12-13 14:35:16

嗯,显然我问的问题是 XE2 中的一个错误,据说已通过更新 1 修复 http://docwiki.embarcadero.com/RADStudio/en/Release_Notes_for_XE2#Please_Install_XE2_Update_1

我会尝试看看它是否真的解决了问题。

Hrmm, apparently the question I asked was a bug in XE2 and supposedly fixed with Update 1 http://docwiki.embarcadero.com/RADStudio/en/Release_Notes_for_XE2#Please_Install_XE2_Update_1

I'll try and see if it really fixed the issue.

-柠檬树下少年和吉他 2024-12-13 14:35:16

唯一适用于 XE2 的版本是 5.1.54 我遇到了同样的问题并通过此解决

The only version works with XE2 was 5.1.54 i had the same problem and being solved by this

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文