Because I needed to do some data access and i want to create some adapters for adonet and rails activerecord. I thought it’d be a good idea to start with a DBI implementation for IronRuby.

You can find it at http://github.com/casualjim/ironruby-dbi or http://code.google.com/p/ironruby-dbi

I packaged the current version up in a zip

To install ironruby-dbi it should should suffice to extract the files you find in the ironruby-dbi archive to the libs folder of your ironruby installation.

For example I track the git repository for updates to ironruby and the git repository is cloned into C:\tools\ironruby

To install ironruby-dbi these are the steps you need to take:

  • Extract the archive
  • Copy the files to ruby/site_ruby/1.8

(on my machine the full path is: C:\tools\ironruby\merlin\external\languages\ruby\redist-libs\ruby\site_ruby\1.8)Start accessing databases :)

To do that start up an ironruby console

require 'dbi' 

conn = DBI.connect('DBI:ADONET:MSSQL:data source=(local);initial catalog=MyDatabase;user id=user;password=password')

statement = conn.execute "Select * from Users" 

while row=statement.fetch
  puts row
end

statement.finish