Delphi XE2 dbExpress MySQL connection

16,922

Solution 1

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.

Solution 2

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.

Solution 3

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!

Solution 4

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.

Share:
16,922
Brian Hawk
Author by

Brian Hawk

Updated on June 04, 2022

Comments

  • Brian Hawk
    Brian Hawk almost 2 years

    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)