开发者

Delphi XE2 dbExpress MySQL connection

开发者 https://www.devze.com 2023-04-07 22:38 出处:网络
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

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 instal开发者_如何学编程lation 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)


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.


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.


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!


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.


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.


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

0

精彩评论

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

关注公众号