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…
Best Answer
I'd say you miss a post for your instance in /etc/freetds.conf. The post should look something like this
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