Leon Guan
Leon Guan

Reputation: 135

Connect to mssql from sqlalchemy by pyodbc on mac os

Anyone has successfully connect to mssql thru pyodbc within sqlalchemy? I am using turbogears2 right now, and try to connect to mssql, working on a mac os platform.

Getting following error:

sqlalchemy.exc.DBAPIError: (Error) ('00000', '[00000] [iODBC][Driver Manager]dlopen({SQL Server}, 6): image not found (0) (SQLDriverConnectW)') None None

Upvotes: 5

Views: 3877

Answers (2)

sorin
sorin

Reputation: 170698

There is a better approach than the old macports or fink, brew:

brew install freetds unixodbc

And it doesn't even need root to install it.

Upvotes: 4

Leon Guan
Leon Guan

Reputation: 135

Easy way by MacPort

Simply do the installation by:

    sudo port install freetds +mssql +odbc +universal

This will install both freetds and unixODBC, we can either using unixODBC for ODBC management, or using iODBC shipped with Mac OS.

Compile and installation

    ./configure --prefix=/usr/local/lib/freetds --with-tdsver=8.0 --enable-msdblib --enable-dbmfix --with-gnu-ld --enable-shared --enable-static
    make
    make install

TDSVER setting

For connecting to SQL Server 2005/8, make sure setting the tds version to 8.0, use following terminal command:

    export TDSVER = 8.0

Lauguange setting

Make sure right language has been setted:

    export LC_ALL=en_US.UTF-8

Upvotes: 2

Related Questions