[unixODBC-support] Error in PHP mode: [unixODBC][FreeTDS][SQL Server]Unable to connect to data source, SQL state S1000

Gérard Maulino gerard at dkeystone.com
Tue Feb 3 08:53:26 GMT 2009

Thanks for your reply Nick,

So by looking for Freetds issues on google I found something which suggested
to add the environment variables in the PHP script. So I added the following
lines at the top of the page:


And now the connection (odbc_connect()) is still failing but the httpd error
is a little different:

PHP Warning:  odbc_connect() [<a
href='function.odbc-connect'>function.odbc-connect</a>]: SQL error:
[unixODBC][Driver Manager]Data source name not found, and no default driver
specified, SQL state IM002 in SQLConnect in
/usr/local/SalomeTMF/DK/DK_Fogbugz.php on line 17

If I 'su apache' and run isql in command line that works.
Any idea?



-----Original Message-----
From: unixodbc-support-bounces at mailman.unixodbc.org
[mailto:unixodbc-support-bounces at mailman.unixodbc.org] On Behalf Of Nick
Sent: lundi 2 février 2009 19:44
To: Support for the unixODBC project
Subject: Re: [unixODBC-support] Error in PHP mode: [unixODBC][FreeTDS][SQL
Server]Unable to connect to data source, SQL state S1000

Gérard Maulino wrote:
> Hi there,
> I'm trying to get Freetds + unixODBC working on a Linux FC 6 and it 
> works in command line but not in Apache/PHP.
> I've checked that the line "extension=odbc.so" is there in the 
> /etc/php.d/odbc.ini file and that my configuration file (freetds.conf, 
> odbc.ini & odbcinst.ini) are correct but I can't find something wrong.
> I've installed unixODBC v 2.2.14 and FreeTDS driver version 0.82 .
> I can query the remote database using isql. That makes me wonder if I 
> need to re-compile or change something in my PHP configuration.
> Any help would be great.
> Thanks in advance.
> Gerard
I would guess its a issue with freetds reading the config files, from the
error php is finding odbc.so, thats finding unixODBC, and thats loading the
freeTDS driver.

unixODBC-support mailing list
unixODBC-support at mailman.unixodbc.org

More information about the unixODBC-support mailing list