【问题标题】:FreeTDS doesn't use configured tds versionFreeTDS 不使用配置的 tds 版本
【发布时间】:2016-11-16 03:29:12
【问题描述】:

freetds v0.91 - tds 版本不匹配

我想在 Ubuntu 14.04 上使用 FreeBSD 连接到 Windows SQL Server。 FreeTDS 是使用 apt-get 安装的。 我使用以下命令尝试了不同的 tds 版本:

$ TDSVER=7.0 tsql -H xxx.xxx.xxx.xxx -U xxxx -p 1433 -P xxxxxxx

日志文件显示:

...
net.c:205:Connecting to xxx.xxx.xxx.xxx port 1433 (TDS version 7.0)
net.c:270:tds_open_socket: connect(2) returned "Operation now in progress"
net.c:310:tds_open_socket() succeeded
...

这里没问题。但如果我将 TDSVER 更改为 7.4:

$ TDSVER=7.4 tsql -H xxx.xxx.xxx.xxx -U xxxx -p 1433 -P xxxxxxx

TDS版本变成4.2了?

...
net.c:205:Connecting to xxx.xxx.xxx.xxx port 1433 (TDS version 4.2)
net.c:270:tds_open_socket: connect(2) returned "Operation now in progress"
net.c:310:tds_open_socket() succeeded
...

命令$ tsql -C的输出是:

Compile-time settings (established with the "configure" script)
                            Version: freetds v0.91
             freetds.conf directory: /etc/freetds
     MS db-lib source compatibility: no
        Sybase binary compatibility: yes
                      Thread safety: yes
                      iconv library: yes
                        TDS version: 4.2
                              iODBC: no
                           unixodbc: yes
              SSPI "trusted" logins: no
                           Kerberos: yes

我尝试在~/.freetds.conf中配置tds版本,结果一样。

freetds v1.00.9 - 匹配

然后我尝试构建从 git 下载的版本并安装在我的主文件夹下。看来版本是匹配的:

$ TDSVER=7.4 .local/bin/tsql -H xxx.xxx.xxx.xxx -U xxxx -p 1433 -P xxxxxxx

...
iconv.c:384:tds_iconv_open: done
net.c:216:Connecting to xxx.xxx.xxx.xxx port 1433 (TDS version 7.4)
net.c:242:tds_open_socket: connect(2) returned "Operation now in progress"
net.c:343:tds_open_socket() succeeded
...

$ .local/bin/tsql -C 的输出为:

Compile-time settings (established with the "configure" script)
                            Version: freetds v1.00.9
             freetds.conf directory: /home/bgdata/.local/etc
     MS db-lib source compatibility: no
        Sybase binary compatibility: no
                      Thread safety: yes
                      iconv library: yes
                        TDS version: auto
                              iODBC: no
                           unixodbc: yes
              SSPI "trusted" logins: no
                           Kerberos: no
                            OpenSSL: no
                             GnuTLS: no
                               MARS: no

这是 v0.91 的错误还是我做错了什么? 谢谢。

【问题讨论】:

    标签: freetds


    【解决方案1】:

    FreeTDS 0.91 不支持 TDS 版本 7.4。我有一个拉取请求,希望在文档中更清楚地说明这一点:

    https://github.com/FreeTDS/freetds/pull/71/files

    • FreeTDS 1.0+ 最高支持 TDS 版本7.4
    • FreeTDS 0.95 最高支持 TDS 版本7.3
    • FreeTDS 0.91 最高支持 TDS 版本7.2

    另外,永远不要使用8.0,除非您使用的是非常旧版本的 FreeTDS(此时您不应该使用它)。文档中也包含了一个很长的故事,但是网络上有很多“指南”推荐它。它恢复到版本7.0 并可能产生问题。

    【讨论】:

      猜你喜欢
      • 2012-10-15
      • 2012-04-24
      • 2020-04-18
      • 1970-01-01
      • 2012-09-09
      • 1970-01-01
      • 2019-12-20
      • 2018-02-03
      • 1970-01-01
      相关资源
      最近更新 更多