FreeTDS doesn't use configured tds version

匿名 (未验证) 提交于 2019-12-03 08:59:04

问题:

freetds v0.91 - tds version mismatched

I want to connect to a Windows SQL Server with FreeBSD on Ubuntu 14.04. The FreeTDS is installed using apt-get. I tried different tds version with following commands:

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

The log file shows:

... 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 ...

No problem here. But if I change TDSVER to 7.4:

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

The TDS version becomes 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 ...

The output of command $ tsql -C is :

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

I tried to configure tds version in ~/.freetds.conf, the results are the same.

freetds v1.00.9 - matched

Then I tried to build the version downloaded from git and install under my home folder. It seems the version is matched:

$ 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 ...

The output of $ .local/bin/tsql -C is:

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

Is that a bug of v0.91 or I did something wrong? Thanks.

回答1:

FreeTDS 0.91 doesn't support TDS Version 7.4. I've got a pull request to hopefully make this more clear in the documentation:

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

  • FreeTDS 1.0+ supports up to TDS version 7.4
  • FreeTDS 0.95 supports up to TDS version 7.3
  • FreeTDS 0.91 supports up to TDS version 7.2

Also, never use 8.0 unless you're using a very old version of FreeTDS (which you shouldn't be at this point). That's a long story also covered in the documentation, but there are lots of "guides" around the web recommending it. It reverts to version 7.0 and can create problems.



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