Friday 19 November 2010

FreeTDS + pyodbc on Snow Leopard

I spent a long, long time trying to get FreeTDS to play nice with with pyodbc, but everytime I tried to connect I was met with the same fateful message

 pyodbc.Error: ('08S01', '[08S01] [FreeTDS][SQL Server]Unable to connect: Adaptive Server is unavailable or does not exist (20009) (SQLDriverConnectW)') 

I tried my bulletproof troubleshooting steps It was plugged & switched on and I’d checked. Many times, using many different methods.

Nothing was working. Then I came across a post entitled mssql + freetds + pyodbc”. It turns out that I needed to compile freetds explicitly setting the TDS Server version.

 ./configure --prefix=/usr/local/freetds --with-iodbc=/usr --with-tdsver=8.0 

Then the usual make & make install

 make sudo make install 

Finally, before my eyes I saw a waterfall of ID’s pouring out from the terminal. It was the most beautiful stdout I’d ever seen.

Thankyou meantheory