Rails, MacOs and SQL Server
October 20th, 2008
For future reference:
If you want to connect to SQL server from mac, these tips may come in handy:
- Turn off the firewall of the Windows machine.
- Start the ‘Sql Server Configuration Manager’. Select ‘SQL Server Network Configuration’ -> ‘Protocols for
’. On the right window, right click on ‘TCP/IP’. The settings should match the following: 
Now, for the rest of these steps, I’m not sure anymore which are necessary and which aren’t. I done all these things, but I’m not too sure which steps were mandator:
- sudo gem install activerecord-sqlserver-adapter
- sudo port install freetds
- sudo vi /opt/local/etc/freetds/freetds.conf : in the ‘global’ section, set ‘tds version’ to ‘8.0’
- tsql -H 10.0.1.191 -p 1433 -U sa -P password. You should get
locale is "nl_BE.UTF-8"
locale charset is "UTF-8"
1>
- in database.yml, use these settings:
adapter: sqlserver
mode: odbc
dsn: DRIVER=/opt/local/lib/libtdsodbc.so;TDS_Version=8.0;SERVER=10.0.1.191;DATABASE=mydb;Port=1433;uid=sa;pwd=password;
I’ve digged through Google to find all this, but the most useful link for me was this one Thanks, Tim!
2 Responses to “Rails, MacOs and SQL Server”
Sorry, comments are closed for this article.

October 20th, 2008 at 06:17 PM Should you ever want to "avoid" sql server, Oracle seems to do a pretty good job on Ruby. At least that's what I was told. I am very biased by my professional occupations of course ;-) http://www.oracle.com/technology/tech/scripting-languages/index.html
October 21st, 2008 at 12:23 PM @mike Thanks. Unfortunately, the SQL Server isn't there by choice: it's a legacy DB that we're going to migrate to PostgreSQL.