【问题标题】:Install Freetds v1 - Centos 6.10 - Connect to MSSQL 2016安装 Freetds v1 - Centos 6.10 - 连接到 MSSQL 2016
【发布时间】:2020-03-29 00:46:41
【问题描述】:

我必须连接到最近升级到 2016 版的 MSSQL 数据库服务器。

我听说我至少需要 freetds 1.0 版。(https://www.freetds.org/userguide/choosingtdsprotocol.htm)

在 Centos 6.10 的 epel 存储库中,我只能找到 freetds 0.91。

如何在 Centos 6.10 上安装 FreeTDS 版本 1?

【问题讨论】:

    标签: sql-server centos6 freetds


    【解决方案1】:

    您可能不需要需要 FreeTDS 1.0+。在 0.91 版中,您仍然可以通过显式传递 TDS_Version 进行连接。例如,来自 Python:

    import pyodbc
    
    con = pyodbc.connect(
        r"DRIVER={FreeTDS};"
        r"SERVER=sql.mydomain.com;"
        r"PORT=1433;"
        r"DATABASE=my_database;"
        f"UID=sql_username;"
        f"PWD=sql_password;"
        r"TDS_Version=7.2;"
    )
    
    cursor = con.cursor;
    
    cursor.execute("SELECT 'this' AS that")
    
    for row in cursor.fetchall():
        print(row)
    

    使用 FreeTDS 0.91,您可以使用的最高 TDS_Version7.2,它将支持 SQL Server 到 SQL Server 2005 的所有功能。只要您不使用 DATETIME 或 @ 987654328@ 字段,您可能会做您需要的事情。试一试?

    如果这还不够,要支持 FreeTDS 版本 7.37.4,您需要从源代码编译:https://www.freetds.org/userguide/config.htm

    【讨论】:

      猜你喜欢
      • 2016-08-17
      • 2023-03-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-21
      • 2019-12-30
      • 2016-10-16
      • 1970-01-01
      相关资源
      最近更新 更多