This post originated from an RSS feed registered with Ruby Buzz
by Daniel Berger.
Original Post: Trick or Sql Server!
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
I just spent seven hours today figuring out how to configure, build and install all of the components needed to talk to a Sql Server database from a Unix box.
I gained 23 gray hairs, broke my right pinky smashing a keyboard and nearly lost an eye to a stray flying pencil in the process, so pay attention! I'm writing this for you. Because I love you.
The most valuable resource was by far this wiki page. That got me about 90% of the way there. Note the extra comments at the bottom. They were very valuable (though slightly off in a couple instances which caused me some grief).
Below is the process you need. Adjust all instances of "/usr/local" as appropriate.
If you're on Solaris, just install the FreeTDS package from blastave. It comes with unixODBC and the msdblib support builtin.
If you install using an rpm/apt-get/whatever, make sure that you have msdblib support builtin. You can tell by running 'tsql -C'. If not, you may have problems.
* Setup your freetds.conf file. It should look something like this:
[some_symbolic_name] host = your.host.com
* Attempt to connect via tsql by running 'tsql -S some_symbolic_name -U login -P passwd'. If you get a prompt, you're good to go. If not, something went wrong.
* Create your database definition files. This is the ODBC stuff. Your /usr/local/etc/odbc.ini entry should look something like this:
[iamspsql01] Driver = FreeTDS Description = ODBC connection via FreeTDS Trace = No Servername = some_symbolic_name Database = YourDatabase
Your /usr/local/etc/odbcinst.ini should look like this: