duanchuang1935 2012-09-03 17:30
浏览 136

无法使用odbc和freetds从php连接到MSSQL 2008 db

I have been searching everywhere for solutions, but am getting more and more confused.

I am trying to connect to a SQL Server 2008 db from php using FreeTDS. The server is a MediaTemple DV 4.0 and it is running CentOS 5.7. I have a version of FreeTDS (v0.91) installed that I think I might have compiled several months back. When I run tsql -C it says my freetds.conf is in /usr/local/etc and a TDS version 5.0. I need it to be TDS version 7.0, but when I change that conf file, it does not change. And I can't find the conf file it is using. (problem 1)

I can connect to my db using tsql -H -p -U and run a query. However in my php file, I get IM002 error which I believe is a connection error to the db. I use odbc_connect for that. (problem 2, the biggest problem)

I don't even know where to start, as I have been installing, uninstalling for about the last 2 months...

I would welcome any suggestion on how to resolve the issue. As a side note, it used to work before I upgraded my DV at MediaTemple.

Thanks! Shawn

Here is my 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: no Sybase binary compatibility: no Thread safety: yes iconv library: yes TDS version: 5.0 iODBC: no unixodbc: yes SSPI "trusted" logins: no Kerberos: no

  • 写回答

2条回答 默认 最新

  • douweng3564 2012-11-05 21:12
    关注

    SQL Server 2008 actually wants TDS Version 7.3 -- not 7.0, which corresponds to SQL Server 7.

    I can't provide assistance with FreeTDS debugging, but you might try a commercial driver where there's some incentive to fix problems, like my employer's offering. It's free to test for 2 weeks.

    We also provide some docs on using PHP with ODBC, on the iODBC.org site.

    评论

报告相同问题?

悬赏问题

  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法