It's been awhile

April 14th, 2008

It’s been awhile since I’ve written anything. I’ve been deep into sites using Ruby/Rails, but now I’ve started playing around with JRuby/Rails. As such, I want to write down the steps to connect to a sqlserver database from JRuby.

First, download the sqlserver.jar file from Microsoft. Place it in the lib directory of your JRuby installation.

Second, configure your database.yml file to read like so:

ActiveRecord::Base.establish_connection(
    :adapter=> 'jdbc',
    :url=> 'jdbc:sqlserver://MyDatabaseServer;databaseName=MyDataBaseName',
    :driver => 'com.microsoft.jdbc.sqlserver.SQLServerDriver',
    :username=>'xxxxxxxx',
    :password=>'xxxxxxxx'
    )

Thirdly…..there is not step three!

Sorry, comments are closed for this article.