iODBC在Mac OSX 10.6.4下不起作用 [英] iODBC does not work under Mac OSX 10.6.4
问题描述
我已经在程序包(http://www.iodbc.org/dataspace/iodbc/wiki/iODBC/)上安装了iODBC,并按照以下说明设置了所有配置文件:
I've installed iODBC over the package (http://www.iodbc.org/dataspace/iodbc/wiki/iODBC/) and set up all config files as described here: http://blog.opensteam.net/past/2009/1/28/rails_ms_sql_on_mac/
我在Linux机器上设置了相同的东西,并且工作正常.在我的Mac OSX 10.6.4上,如果我测试连接,则会收到此错误:
I set up the same thing on a Linux machine and it worked fine. On my Mac OSX 10.6.4, I get this error if i test the connection:
xxx@xxx:/opt/local/include$ iodbctest "dsn=res;uid=user;pwd=pass"
iODBC Demonstration program
This program shows an interactive SQL processor
Driver Manager: 03.52.0709.0909
1: SQLDriverConnect = [iODBC][Driver Manager]dlopen(/opt/local/lib/libtdsodbc.so, 6): Symbol not found: _CreateDataSource
Referenced from: /usr/lib/libiodbcinst.2.dylib
Expected in: flat namespace
(0) SQLSTATE=00000
2: SQLDriverConnect = [iODBC][Driver Manager]Specified driver could not be loaded (0) SQLSTATE=IM003
我不知道该如何调试:(
I have no idea how to debug this :(
推荐答案
要遵循的步骤:
-
brew install freetds
subl ~/Library/ODBC/odbc.ini
[sqlserver01]
驱动程序=/usr/local/lib/libtdsodbc.so
TDS_Version = 7.2
服务器= 192.168.8.7
端口= 1433
跟踪=是
说明= ds01
#数据库=
#无法为freetds指定用户名和密码
[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
subl ~/.freetds.conf
host = ds01.uswa.net#服务器名称
端口= 1433
tds版本= 8.0#适用于2008 +
host = ds01.uswa.net # server name
port = 1433
tds version = 8.0 # works with 2008+
sudo pip安装pyodbc sudo pip安装sqlsoup
sudo pip install pyodbc sudo pip install sqlsoup
Python连接字符串如下所示:
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')
SQLAlchemy的方式如下所示:
The SQLAlchemy way would look like this:
engine = create_engine('mssql+pyodbc://Steve:steve@sqlserver01')`
进行任何查询...
这篇关于iODBC在Mac OSX 10.6.4下不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!