1
votes

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

2 Answers

0
votes

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.

0
votes

Verify that debugging is turned on in your odbcinst.ini and that errors are sent to the defined logfile.

Try to connect and run a query using the iSQL tool and check your debug log for errors. The tool comes with the unixODBC package and uses your DSN to connect to your database.

You might also want to take a look at this page: Sometimes isql doesn't connect and tsql does