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- 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- Supported Servers
- dbExpress
- ...
- MySQL 5.1, 5.0.27, 4.1* (Pro/Ent/Ult/Arch) (Driver dbxMYS.dll, Client libmysql.dll)
- The following combinations have been tested:
- LibMySQL.dll (5.1.XX) DBXMys.dll MySQL 4.0.XX Server
- LibMySQL.dll (5.1.XX) DBXMys.dll MySQL 4.0.XX Server
- LibMySQL.dll (5.1.XX) DBXMys.dll MySQL 5.0.XX Server
- 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.
Thank you!