John Kaster

Behind the Screen

RAD Studio Tip #1: Quickly configuring MySQL to use with dbExpress and Data Explorer

with 7 comments

When developing and debugging applications for EDN, I use several different Windows VMs for various reasons. Periodically, I want to use the RAD Studio Data Explorer to look at some values in a MySQL database. If libmysql.dll (the MySQL driver dll) is missing from the machine or not in the right path, I typically see this error when trying to view a MySQL database with Data Explorer:

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

The MySQL dll is freely available to download from http://dev.mysql.com/downloads/mysql and the install available there usually will put the libmysql.dll file dbExpress requires in a path that allows dbExpress to load it.

This is good for setting up for one machine, but once you have a copy of that dll available, nothing else is required to access MySQL from dbExpress. So, when I need to configure a new machine for MySQL access, I just copy that dll to the appropriate path on the new machine.

For 32-bit Windows machines, libmysql.dll should typically be in c:\windows\system32.

For 64-bit Windows machines, libmysql.dll should typically be in c:\windows\SysWOW64.

Once dbExpress can find this dll, all you need to do is restart the IDE and you should be ready to access your MySQL databases either locally or remotely.

I hope this simple tip helps – I use it frequently enough, I decided it was worth blogging about. 🙂

Advertisements

Written by John Kaster

August 6, 2010 at 1:29 pm

7 Responses

Subscribe to comments with RSS.

  1. I’d like to have my app access a MySQL database on my server from a customer’s PC, where the exe is on a server on the customer’s network. Does this tip mean that it is *NOT* sufficient to have libmysql.dll in the same folder as the app’s exe? Does it have to be on each user’s PC on the customer’s network, or can it be somewhere on customer’s server, and if so, where? (THANK YOU)

    Kevin Killion

    August 8, 2010 at 10:21 am

  2. When will be available a PostgreSQL DbExpress driver ?

    Fernando Perez

    August 8, 2010 at 11:45 pm

  3. @Kevin, you don’t have to put the MySQL DLL under the Windows directory structure. I just put it there because that’s where the MySQL install puts it as well. It should work fine if you have the DLL anywhere on your path for dbExpress to find. Alternatively, you could use DataSnap for your client applications, and not have to deploy the MySQL DLL to the client at all.

    @Thomas, understood about the proliferation of non-Windows files in \Windows\System32 or \Windows\SysWOW64 … I use that path simply because that’s where MySQL installs its DLL in its install, so if someone familiar with MySQL were to look for the DLL, they’d know where to look to update it if necessary.

    John Kaster

    August 9, 2010 at 1:19 pm

  4. @Fernando and Thomas,

    There is an existing QC request (and some duplicates that point to it) for PostgreSQL support in dbExpress. I’ve re-opened that report so you can cast your votes for it. I have nothing to announce regarding support for PostgreSQL in dbExpress, though — sorry.

    Report No: 41013 Status: Open
    PostgreSQL support for DBX4
    http://qc.embarcadero.com/wc/qcmain.aspx?d=41013
    QCWIN:Defect_No=41013

    John Kaster

    August 9, 2010 at 2:22 pm

  5. Also bear in mind you’ll need the libmysql.dll that comes with the full MySQL server distribution, not the one that comes with stand-alone Connector/C package – see https://forums.embarcadero.com/thread.jspa?threadID=36278&tstart=0

    Peter Hull

    August 10, 2010 at 1:01 am

  6. Peter, good reminder, thanks for that.

    John Kaster

    August 10, 2010 at 9:15 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: