开发者

Connect to mssql from sqlalchemy by pyodbc on mac os

开发者 https://www.devze.com 2023-02-04 06:16 出处:网络
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.

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 Manag开发者_StackOverflow中文版er]dlopen({SQL Server}, 6): image not found (0) (SQLDriverConnectW)') None None


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.


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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号