radstudio logo

Getting embarcadero dbexpress mysql working - DBX Error: Driver not initialized

Sometimes the simple things are harder than you expected and dbexpress probably comes under that category, it was less express than I had expected but once you figure things out it does work. Some of the problems were my fault while others took time due to the obscur nature of the errors returned by XE and XE2.

If you start by adding the TSQLConnect component, select the MySQL driver and configure your HostName, Database, UserName and Password you can try and connect, you will most likely strike the following error :-

Show Plain Text
Text code
  1. DBX Error: Driver could not be properly initialized. Client library may be missing, not installed properly, of the wrong version, or the driver maybe be missing from the system path...

So once you figure out that your missing the libmysql.dll you might try and grab the latest MYSQL C Connector from dev.mysql.com, they are up to version 6.0.2 at the time of writing this, you'll get the same error above. I was getting a more obscure crash before XE2 Update 1 which I didn't note down at the time, that abstract error message took me a while to figure out and was related to the libmysql.dll version.

It would be nice if embarcadero provided a location where you could download the compatible libmysql.dll files that work with dbexpress, it is worth noting that the XE2 read me does come with the following note :-

Show Plain Text
Text code
  1. Supported Servers
  2. dbExpress
  3. ...
  4. MySQL 5.1, 5.0.27, 4.1* (Pro/Ent/Ult/Arch) (Driver dbxMYS.dll, Client libmysql.dll)
  5.  
  6. The following combinations have been tested:
  7. LibMySQL.dll (5.1.XX)  DBXMys.dll  MySQL 4.0.XX Server  
  8. LibMySQL.dll (5.1.XX)  DBXMys.dll  MySQL 4.0.XX Server  
  9. LibMySQL.dll (5.1.XX)  DBXMys.dll  MySQL 5.0.XX Server  
  10. LibMySQL.dll (5.1.XX)  DBXMys.dll  MySQL 5.1.XX Server

To get a 5.1.XX compatible DLL you will need to download an achieved mysql complete installation zip and extract the DLL as no compatible versioned MYSQL C Connector package could be downloaded when I looked.

To save you some time I added zip download containing the win32 x86 libmysql.dll for those who wish to download.

This is libmysql.dll version 5.1.59 win32 x86 DLL which I have tested and works with both XE and XE2.

15 Responses to “Getting embarcadero dbexpress mysql working - DBX Error: Driver not initialized”

Thank you!

Thank you very much, you saved me. I was having the same problem. I downloaded the libmysql.lib in the above link and now it works. Thank you 1000 times.

Thanks!!!!

I continue with the problem. (I'm running Embarcadero ® Version 4.2.0.1617 RadPHP ™ XE2 in Windows 7) What I did was: Download the ZIP file, Extract libmysql.dll, Place it in the folder C: \ Program Files (x86) \ Embarcadero \ RadPHP \ 4.0 \ bin. I got the message: "Can not load libmysql.dll library (error code 6). Libmysql.dll library May be missing from the system path or You May Have An incompatible version of the library installed" Any advice is welcome. Enrique

@Enrique You will need to make sure the the DLL is in your win7 Path. I haven't tried in RadPHP XE2 but for Rad Studio XE & XE2 I have it in C:\Users\Public\Documents\RAD Studio\9.0\BPL. You can check what paths are being used on your system by typing "path" in a command prompt and putting the DLL in the appropriate place.

Thank you so much Brett, I'll try soon. Best regards.

Well done! Solved my problem also (Win7x64 and Delphi XE2). Thanks

Dear Brett. I searched and "destroyed" all versions of libmysql.dll resident on my PC. The route used by RadPHP XE2, is the previously indicated (C: \ Program Files (x86) \ Embarcadero \ RadPHP \ 4.0 \ bin). Anyway, I put libmysql.dll (version 5.1.59) in the Windows path and in % SystemRoot% \ System32. I changed the environment variable "Path" to reflect the changes, but the error persists. Interestingly, when testing the connection works fine, but the error (DBX: Not supported) persists when try to show tables, procedures, etc. For now, I give up. I had never taken so long to set up a connection. Best regards.

Excellent, you save me!

Thanks man. It work's. (Win2008x64 and Delphi XE).

THAAAAAAAAAAAAAAAAAAAAAAANKS! LOL It seems to be working! ;D Well done man. (WIN7x32 - Delphi XE2 - MYSQL 5.5)

thx a lot,will test it later

Thank you very much. Great - You saved me lots of time. (Win7x64 and Delphi XE2)

I am having exact same problem as Enrique above, (DBX: Not supported). I can connect to a local instance of mySQL and browse tables with database manager, but for the remote instance it says "test succeeded" but when I try to browse tables it gives the above error. libmysql.dll is exact same version on my web server. DBX I am assuming is dbexpress. Does anyone know if there are additional files required on the webserver to work with a remote mysql connection? Win7 64 OS on desktop, all mysql 5.1.56 32bit on desktop and webserver. Any suggestions appreciated, ready to pull my hair out here, thanks.

Thanks a lot! I do hope this is added to the somewhat lacking documentation of embracedero XE2

Post a comment