Recently I needed to hook up a rails app to MSSQL 2005. Some quick google searches and I get tons of information that is contradictory and out of date. Once I figured out all the right steps, it is very easy to get running:
Follow up:
First step, install the activerecord gem:
gem install activerecord-sqlserver-adapter
Next you have to go get the binary ODBC driver for windows. It can be found here: http://www.ch-werner.de/rubyodbc/
Then you set up your ODBC connection, this is in the windows control panel. It is either directly in the control panel or under administrative tools depending on what version you are running.
Once you have the ODBC connection set up, you simply need to set up the DSN in your database.yml:
development:
adapter: sqlserver
database: briansblog
username: brian
password: password
mode: odbc
dsn: ODBC-DSN-THAT-YOU-SETUP
Thats all there is to it. Beware if you have any custom sql queries, you might have to change them if you used anything MySQL specific (like LIMIT).
Recent Comments