MyODBC not showing in drivers list on Mac OS X

Today I missed a bunch of good talks that I was hoping to attend, because I was figuring out a problem at the Guru Bar. Offending criminal: MySQL Connector/ODBC 3.51. Offending OS: Mac OS X/PowerPC.

OS X comes with an ODBC Administrator. Once you unpack the MySQL package, and the .pkg installs itself, you’ll find that all your files are installed in /usr/lib. You need to fire up ODBC Administrator, click on Drivers, and Add the driver. Give it an appropriate Description (MySQL), provide the location of the driver file (/usr/lib/libmyodbc3.dylib), and define it as available within the System (this enables you to enable at the System DSN as well as the User DSN, in the next step).

Later, etiher add as a user or system DSN, one for mysql. The keyword/value pairs are such that it should be: server/localhost, port/3306, database/test.

The caveat with all of this, is that you actually need to have /usr/lib/libltdl.3.dylib present. Because libmyodbc3.dylib references it, and if you don’t have it, it will fail rather beautifully. How do you get libltdl.3.dylib? Get XCode! If you don’t have your install discs around, get it from the Apple Developer Connection. Beware, its a 923MB download (now you see why I missed not only a talk – large downloads at the conference tend to break, duh!).

Testing the ODBC connection? Make good use of /usr/bin/iodbctest. We were of course doing some odd things with Microsoft Excel (ick!). Once /usr/lib/libltdl.3.dylib is installed, the ODBC connection magically works. With regards to Excel, the external data source will just show up and thus, you can use it. If you didn’t define the keyword/value pairs in the ODBC Administrator, you can always do it in Excel (however, running iodbctest will then fail).

Why was this not discovered earlier? Probably because developer tools are a really common thing to have installed. But users, tend to not have XCode installed, by default. And OS X doesn’t have packaging guidelines, unlike sensible RPM/DEB. When I get back, I’ll see if its possible to ship this missing bit otherwise get the Documentation team to update documentation…

Bottom-line: Make sure XCode is installed if you’re going to use Connector/ODBC.

Technorati Tags: , , , , , ,


i