[freetds] New to FreeTDS / ODBC

ZIGLIO Frediano Frediano.Ziglio at vodafone.com
Tue Jul 1 18:46:47 EDT 2003


> 
> I am attempting to setup a Redhat Linux 9 box with PHP 4.2.2 
> and Apache 
> 2.0.40 to connect with a MSSQL server database using FreeTDS. 
> This has 
> been headache after headache.
> 
> i am able to connect with tsql fine. My ODBC connection scripts from 
> PHP on the other hand are a bit different...
> 
> I am currently getting the following error:
> SQL error: [unixODBC]Client unable to establish connection, SQL state 
> S1000 in SQLConnect in /var/www/html/rossmach/odbc_test.php
> 
> the error is coming from this statement:
> $connection = 
> odbc_connect("Driver=TDS;Server=192.168.0.3:1433;Database=ARMCODATA", 
> "username", "password", "Integrated Security=NO") or 
> die(odbc_error());
> 
> My freetds.conf file contains this info for the DSN:
> [TDS]
>          host = 192.168.0.3
>          port = 1433
>          tds version = 4.2
> 

With freetds.conf you should use Servername, not Server option. Also you
have to compile odbcinst.ini for driver name. My odbcinst.ini (/etc)
contains

[FreeTDS]
Description             = FreeTDS driver
Driver          =
/home/fziglio/cpp/freetds/freetds/src/odbc/.libs/libtdsodbc.so
FileUsage               = 1

So I can use connections like
odbc_connect("Driver={FreeTDS};Servername=TDS;Database=ARMCODATA",
"username", "password") (it should work)

freddy77


More information about the FreeTDS mailing list