Writing here because really can't figure out what to do. I have a site located at ftp server. And now it moves to a new server based on Linux/nginx. And everything is fine except SQL Server ODBC driver. I need to connect to a SQL Server database on my php code through odbc_connect function. I asked administrators of nginx to add required driver to nginx settings, gave them host, port and tds version and they added, but it doesn't work. giving me an error:

Warning: odbc_connect(): SQL error: [unixODBC][FreeTDS][SQL Server]Unable to connect to data source, SQL state S1000 in SQLConnect in

I'm using the same connection string as earlier.

$odbc = odbc_connect("DSN=dsn_name; Host=x.x.x.x,port_number;", "login", "pass");

Maybe we need to do some specific things to make it work? Thanks.

We some some more odbc drivers and them work fine (Sybase for example). I use AquaData Studio on my local machine to access to datasources and found that authentication setting exists only on a SQL Server database...

1 Answer 1


I'd say you miss a post for your instance in /etc/freetds.conf. The post should look something like this

    host = some_db_host_address
    port = 1433
    tds version = 8.0

Then in your connection string you should use that alias. The host and port part shouldn't be needed as they are picked up from the configuration file. You may have to say which driver to use. This works for me

$conn = odbc_connect("Driver=FreeTDS;DSN=my_alias","user","pass");
  • Thanks a lot. I can find this file only on /etc/freetds.conf? Can it be named with another name? Commented Oct 22, 2014 at 11:58
  • Try looking for it in /usr/local/etc which should be the default location. Here's a link to the documentation regarding the freetds.conf file freetds.org/userguide/freetdsconf.htm
    – cba
    Commented Oct 22, 2014 at 12:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.