iODBC does not work under Mac OSX 10.6.4

▼魔方 西西 提交于 2019-12-06 05:41:26

It would be interesting to see what params you have in your odbc.ini and odbcinst.ini files for the DSN and FreeTDS driver being used ?

Looks as if the Apple iODBC Driver Manager is not able to load setup routines required for the driver nor does the FreeTDS driver itself.

The OpenLink iODBC Driver Manager for Mac OS X (which Apples bundled one is based on) is Framework based and does include routines for loading generic setup and login dialogs for those ODBC drivers that do not have built in one. You can download it free (as it is open source) from the following location:

http://www.iodbc.org/downloads/iODBC/iodbc-sdk-3.52.7-macosx-10.5.dmg (it is for 10.5 and 10.6)

Steven Elliott Jr

Steps to follow:

  1. brew install freetds

  2. subl ~/Library/ODBC/odbc.ini

  3. [sqlserver01]
    Driver=/usr/local/lib/libtdsodbc.so
    TDS_Version=7.2
    Server=192.168.8.7
    Port = 1433
    Trace = Yes
    Description=ds01
    # Database=
    # can't specify username and password for freetds

  4. subl ~/.freetds.conf

  5. host = ds01.uswa.net # server name
    port = 1433
    tds version = 8.0 # works with 2008+

  6. sudo pip install pyodbc sudo pip install sqlsoup

The Python Connection String would look like this:

# Steve is my username; steve is my password; #sqlserver01 is my DSN in odbc.ini
db = sqlsoup.SQLSoup('mssql+pyodbc://Steve:steve@sqlserver01')

The SQLAlchemy way would look like this:

engine = create_engine('mssql+pyodbc://Steve:steve@sqlserver01')`

Do whatever queries…

I had the same problem, linux works, Lion 10.7 not (I guess same problem for 10.6). I'm using FreeTDS driver to connect, compiling from the source code: it looks like that when compiling, libtdsodbc.so is compiled for the wrong architecture or 32bit/64bit.

I followed this guide (excluding Excel part), and everything worked like a charm. http://asmiler.blogspot.fr/2011/10/accessing-mssql-databases-from-excel.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!