sql server 2005 and odbc-rails

Here’s how I {finally} got mssql 2005 to play nicely with my rails app:

~side-stepping the win32ole db error cannot create new connection because in manual or distributed transaction mode ~

  1. install odbc-rails using the Manual method. the gem and plugin methods didn’t work out for me.
  2. i copied Christian Werner’s odbc binding to \lib\ruby\site_ruby\1.8\i386-msvcrt but i believe the Manual method install script adds them (odbc_utf8.so, odbc.so) if they don’t already exist. check for them after running install_odbc.rb. also, Ruby v186 one-click installer includes the odbc.so binary, and i’m using that one instead of Werner’s: so far, so good.
  3. create a system dsn. in Windows, go to Start | Admin Tools | Data Sources. i created separate dsn’s for test and dev environments.
  4. database.config looks something like:

 test:
  adapter: odbc
  dsn: <dsn name>
  username: <Username>
  password: <Password>
  emulate_booleans: false
  trace: true

I don't believe you need emulate_booleans for mssql.

Posted by Luke on Wednesday, September 05, 2007

Comments (1)


Heather on Wednesday, September 05, 2007

Fascinating. Glad to hear it’s working.