我必须使用 ODBC 从 Arch Linux 连接到 MSSQL 服务器。我使用 FreeTDS,并使用 isql,它正在工作:
isql sqlexpress dev 开发
但不是在 PHP 中。我在交互模式下使用 PHP:
PHP > $conn = odbc_connect("sqlexpress", 'dev', 'Dev');
PHP > $a=odbc_exec($conn, 'SELECT * FROM measures;');
PHP Warning: odbc_exec(): SQL error: [FreeTDS][SQL Server]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 1 (""): Data type 0x00 is unknown., SQL state 37000 in SQLExecDirect in php shell code on line 1
Warning: odbc_exec(): SQL error: [FreeTDS][SQL Server]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 1 (""): Data type 0x00 is unknown., SQL state 37000 in SQLExecDirect in php shell code on line 1
我进行了很多搜索,但找不到任何解决方案(甚至找不到有同样问题的人)。我的配置文件:
/etc/odbc.ini:
[sqlexpress]
Server = 192.168.10.39
Port = 1433
Driver = FreeTDS
Database = capture
UserName = dev
Password = Dev
/etc/odbcinst.ini:
[FreeTDS]
Description = FreeTDS driver
Driver = /usr/lib/libtdsodbc.so
Setup = /usr/lib/libtdsS.so
Trace = Yes
TraceFile = /tmp/freetds.log
FileUsage = 1
UsageCount = 1
祝你今天过得愉快!伴侣