just in ram

A list of stuff I should remember but never do

Connecting Ruby on Rails to Microsoft SQL Server

with 8 comments

NOTE: These instructions are now seriously out of date. You may want to check out my always up to date *cheap* ebook instead. Connecting Ruby on Rails to Microsoft SQL Server eBook

It appears rails does not connect to MS SQL Server right out of the box. You need to do the following to get the connection to work:

Get the latest source distribution of Ruby-DBI and copy the file:

bdi-0.1.0/lib/dbd/ADO.rb

to:

c:/ruby/lib/ruby/site_ruby/1.8/DBD/ADO/ADO.rb

NOTE: The ADO directory does not exist on a standard install, you will need to create it.

Then simply set up your railsapp/config/database.yml

Here’s an example for reference:

development:
  adapter: sqlserver
  database: database_name
  host: server_name
  username: user_name
  password: your_pw_here

Written by Justin Ramel

April 7th, 2006 at 8:39 pm

Posted in Ruby on Rails