Rails 3, Ruby 1.9.2, Windows 2008, and SQL Server 2008 Tutorial
This took me a while to figure out, especially since I’m not so great with either windows or SQL server, but in the end the process isn’t so difficult.
Rails 3, Ruby 1.9.2, Windows 2008, and SQL Server 2008 Screencast
The steps covered in this screencast are:
- Create user
- Create database
- Give user permissions
- Create DSN
- Install ruby
- Install devkit (Needed to complie native extensions for ODBC)
- Create a new rails app
- Add
activerecord-sqlserver-adapter
andruby-odbc
to Gemfile - Customize
config/database.yml
1 2 3 4 5 6 7 8 |
# config/database.yml development: adapter: sqlserver dsn: testdsn_user mode: odbc database: test username: xavier password: |
Some errors you may encounter:
The specified module could not be found – odbc.so You have likely copied odbc.so from i386-msvcrt-ruby-odbc.zip. This is for 1.8.7, and does not work for 1.9. Remove the .so file, and install ruby-odbc as above.
The specified DSN contains an architecture mismatch between the Driver and the Application. Perhaps you have created a system DSN. Try creating a user DSN instead. I also found some suggestions that you need to use a different version of the ODBC configuration panel, but this wasn’t relevant for me.