【问题标题】:Connecting to MS SQL (Azure) using FreeTDS使用 FreeTDS 连接到 MS SQL (Azure)
【发布时间】: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.0TDSVER=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

谁能帮我诊断和解决这个问题?

谢谢!

【问题讨论】:

    标签: macos azure freetds


    【解决方案1】:

    检查此链接。它解决了我和你类似的问题。

    http://martinrichards.tumblr.com/post/28488121620/connecting-to-sql-azure-using-freetds

    【讨论】:

    • 感谢 Jan 的帮助。尝试编译 FreeTDS 的新副本,这似乎帮助我解决了这个问题。这是使用 openssl 编译它的关键,因为 macports 版本不包含它。
    • 在制作和安装 freetds 之前我必须安装 openssl (sudo apt-get install libssl-dev)
    猜你喜欢
    • 2016-07-16
    • 2012-07-09
    • 2021-08-26
    • 1970-01-01
    • 2011-02-23
    • 2016-10-22
    • 2011-03-16
    • 2019-12-12
    • 2016-04-25
    相关资源
    最近更新 更多