How to Connect to SQL Server 2005 Database Through Ruby

Ruby Connecting to SQL Server 2005

It appears after you specify DBI:DriverName: you can put whatever connection info you need

DBI.connect("DBI:ODBC:Driver={SQL Server};Server=#{server};Database=#{db};Trusted_Connection=yes")

http://www.devlist.com/ConnectionStringsPage.aspx

Ruby on Rails + Sql Server 2005

So just make sure if you're working on Windows or Mac to set up an ODBC connection. You must indicate this explicitly in your database configuration for Rails.

Connecting to an MSSQL database from a Ruby on Rails application running on Ubuntu

This Stackoverflow question might help: Rails & MSSQL 2008 - Will We Hit Barriers?

Basically you will need to install a MSSQL database adapter (rather than MySQL or Postgres that most tutorials step you through), and configure your database.yml appropriately:

http://rorblog.techcfl.com/2008/04/14/ruby-on-rails-connection-to-sql-server/

http://the-banana-peel.saltybanana.com/2008/06/connecto-to-microsoft-sql-server-from.html

http://wiki.rubyonrails.org/database-support/ms-sql (Although the rails wiki looks down at time of writing)

P.S. I am assuming the MSSQL server will be running on a separate Microsoft server someplace.

How to connect to SQLServer 2k5 using Ruby 1.8.7 over W2k3 with active record 2.3.5

Ok, so I figured out.
The problem was on the missing ruby-odbc (currently version 0.9999), so, after the install of this gem all worked fine.

BUT, in one of my servers (the wich one that runs w2k8 server) I need to install the Ruby DevKit also (before the ruby-odbc gem)

That's odd.

Well. I hope that this can help someone else.
Cheers!



Related Topics



Leave a reply



Submit