Using MySQL and Ruby on Vista

So I need to import data from a MS SQL Server database into a MySQL database.  Basically I’m helping someone move from a custom build ASP web site to a Drupal PHP site.  I’ve been using Ruby on Rails for a while now and want to use Ruby and ActiveRecord.  I’ll also mention that using RoR instead of Drupal is not an option.

In my mind MySQL and Ruby should go together like Gin and Tonic.  But… not so fast if you happen to be using Vista.  I lost that better part of a day (night really) trying to get things working with Ruby and MySQL.   There are some incompatibilities between the platforms that are not obvious or well documented.  Ruby and or Ruby on Rails developers don’t tend to give a shit about developers using a Windows platform.  On a couple of occasions I’ve been told straight out to use a Mac or Linux.  I usually use Ubuntu, but in this case I cannot.

I’ll also mention as an aside that getting Ruby to run against MS SQL Server was easy: http://snippets.dzone.com/posts/show/3906

Here is what I can remember doing to get Ruby and MySQL to play nice on Vista:

  1. Install MySQL version 5.0.* and ensure it is the 32 bit version.  I run 64 bit Vista and I found MySQL 64 bit has compatibility issues.  Also, MySQL 5.1.* does not work either.
  2. Run “gem install mysql include-dependencies” and choose option #1
  3. Put the libmysql.dll from the installed MySQL directory into the <installed_dir>\ruby\bin directory
  4. Add the MySQL bin directory to your PATH

I wasted hours figuring out the above steps.  If this help even one person I think this post is worth it.  Happy hunting.


About this entry