Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cleitonfco/417215 to your computer and use it in GitHub Desktop.
Save cleitonfco/417215 to your computer and use it in GitHub Desktop.
UNIXODBC, FREETDS, RUBYODBC, SQL SERVER AND SNOW LEOPARD
========================================================
INSTALLING
----------
(Attribution: http://hughevans.net/2009/11/05/homebrew-ruby-odbc)
$ sudo brew install unixodbc
$ sudo brew install freetds
$ sudo env ARCHFLAGS="-arch x86_64" brew install ruby-odbc
$ ln -s /usr/local/Cellar/unixodbc/{version}/etc/odbc.ini ~/.odbc.ini
$ ln -s /usr/local/Cellar/unixodbc/{version}/etc/odbcinst.ini ~/.odbcinst.ini
$ ln -s /usr/local/Cellar/freetds/{version}/etc/freetds.conf ~/.freetds.conf
CONFIGURING
-----------
Configure ~/.freetds.conf, put this:
[LABELTDS]
host = DOMAIN_OR_IP_HOST
port = PORT_DEFAULT_1433
tds version = 8.0
client charset = UTF-8
Configure ~/.odbc.ini
[DSN]
Driver = FreeTDS
Description = ODBC connection via FreeTDS
Trace = No
Servername = LABELTDS (same used in freetds.conf)
Database = DATABASE_NAME
Configure ~/.odbcins.ini
[FreeTDS]
Description = TDS driver (Sybase/MS SQL)
Driver = /usr/local/Cellar/freetds/0.82/lib/libtdsodbc.so
Setup = /usr/local/Cellar/unixodbc/2.2.14/lib/libtdsS.so
CPTimeout =
CPReuse =
FileUsage = 1
TESTING
-------
$ isql -v DSN USERNAME PASSWORD
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL> Select * from people;
And that's it!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment