【发布时间】:2014-11-06 10:39:37
【问题描述】:
我在 Mac OS X Mavericks 上,并尝试使用 pyodbc 连接到 Microsoft Azure MS SQL 服务器。为简单起见,我想使用无 DSN 连接,并使用 MacPorts 安装了 FreeTDS 和 pyodbc(这是我最终要使用的)。
1. tsql 配置
$ tsql -C
Compile-time settings (established with the "configure" script)
Version: freetds v0.91.103
freetds.conf directory: /opt/local/etc/freetds
MS db-lib source compatibility: no
Sybase binary compatibility: no
Thread safety: yes
iconv library: yes
TDS version: 5.0
iODBC: no
unixodbc: no
SSPI "trusted" logins: no
Kerberos: no
2。 odbc.ini (/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/databases/MyODBC/files/odbc.ini)
[MSSQL]
Description = MyDatabase
Driver = FreeTDS
Servername = xxxxxxx.database.windows.net
UID = username
PWD = password
Port = 1433
TDS_Version = 7.0
3. isql 测试
$ isql -v MSSQL
[IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified
[ISQL]ERROR: Could not SQLConnect
4. tsql 测试
$ tsql -H xxxxxxxx.database.windows.net -p 1433 -U xxxxxx -P xxxxxx
locale is "en_AU.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Error 20002 (severity 9):
Adaptive Server connection failed
There was a problem connecting to the server
我尝试在命令前面使用TDSVER=8.0 和TDSVER=7.1,就像在this post 中所做的那样。使用TDSVER=7.1 我得到一个稍微不同的错误......
Error 20017 (severity 9):
Unexpected EOF from the server
Error 20002 (severity 9):
Adaptive Server connection failed
There was a problem connecting to the server
谁能帮我诊断和解决这个问题?
谢谢!
【问题讨论】: