Sunday, May 25, 2008

Mysql Ruby Extension

Installing in Windows

Download mysql dev files from : http://dev.mysql.com/downloads/mysql/5.0.html
Install them in your hard drive. We only need the include and lib files, not the server. Download the zip package.

Download last mysql-ruby extension from http://tmtm.org/downloads/mysql/ruby/ and extract it.

we run extconf.rb with the following parameters:

ruby extconf.rb --with-mysql-include=/path/to/mysql/include --with-mysql-lib=/path/to/libs

By default the mysql installer saves the lib files in the lib/opt.

To compile the extension:

nmake

Now we should have a valid mysql.so file. We need to get the libmysql.dll from the bin folder of the mysql distribution, you can grab it from the zip version.

To test it:

ruby test.rb [hostname [user [passwd [dbname [port [socket [flag]]]]]]]

No comments: