sql-server – freeTDS不使用其配置
发布时间:2020-12-12 06:56:49 所属栏目:MsSql教程 来源:网络整理
导读:我决定使用FreeTDS驱动程序和unixODBC管理基于LAMP的应用程序与远程MsSQL数据库之间的PDO连接。 不幸的是,驱动程序似乎没有读取freetds.conf文件,也没有直接通过服务器的CLI设置环境变量,或者通过putenv()函数在php文件中指定环境变量。 现在一些数据: 因
我决定使用FreeTDS驱动程序和unixODBC管理基于LAMP的应用程序与远程MsSQL数据库之间的PDO连接。
不幸的是,驱动程序似乎没有读取freetds.conf文件,也没有直接通过服务器的CLI设置环境变量,或者通过putenv()函数在php文件中指定环境变量。 现在一些数据: >因为我ping服务器 – 没有数据包丢失。 TDSVER=7.0 tsql -H >IP< -p 1433 -U username 我提示输入密码并建立连接。 Error 20017 (severity 9): Unexpected EOF from the server OS error 115,"Operation now in progress" Error 20002 (severity 9): Adaptive Server connection failed There was a problem connecting to the server > tsql -C命令回显这样的输出: Compile-time settings (established with the "configure" script) Version: freetds v0.91 freetds.conf directory: /usr/local/etc MS db-lib source compatibility: yes Sybase binary compatibility: no Thread safety: yes iconv library: yes TDS version: 5.0 iODBC: no unixodbc: yes SSPI "trusted" logins: no Kerberos: no > freetds.conf在上面给出的位置有这个条目: [MSSQL] host = >IP< port = 1433 tds version = 7.0 > ISQL也失败: isql -v MSSQL [S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source [01000][unixODBC][FreeTDS][SQL Server]Adaptive Server connection failed [ISQL]ERROR: Could not SQLConnect >我的odbc.ini: [MSSQL] Description = MS SQL Server Driver = FreeTDS TDS_Version = 7.0 Server = >IP< UID = username PWD = password ReadOnly = No Port = 1433 我想这个解决方案真的很简单,但是我太笨了,找不到它 解决方法我的直觉是你需要在你的freetds.conf和odbc.ini文件中将你的tds version = 7.0更改为tds version = 8.0,而你需要在你的odbcinst.ini文件里。这是我在Ubuntu 12.04服务器上与远程MSSQL服务器通话的工作原理:freetds.conf # Define a connection to the MSSQL server. [mssql] host = myserver port = 1433 tds version = 8.0 ODBC.INI # Define a connection to the MSSQL server. # The Description can be whatever we want it to be. # The Driver value must match what we have defined in /etc/odbcinst.ini # The Database name must be the name of the database this connection will connect to. # The ServerName is the name we defined in /etc/freetds/freetds.conf # The TDS_Version should match what we defined in /etc/freetds/freetds.conf [mssql] Description = MSSQL Server Driver = freetds Database = MyDB ServerName = myserver TDS_Version = 8.0 ODBCINST.INI # Define where to find the driver for the Free TDS connections. [freetds] Description = MS SQL database access with Free TDS Driver = /usr/lib/i386-linux-gnu/odbc/libtdsodbc.so Setup = /usr/lib/i386-linux-gnu/odbc/libtdsS.so UsageCount = 1 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容