[freetds] (no subject)

Craig Metrolis craigmetrolis at medicinechestrx.com
Tue Dec 23 15:06:16 EST 2008


Hi, I am trying to setup an odbc connection to a Microsoft SQL Express
server using an "ODBC-combined" configuration. Both isql and tsql are
working fine, but whenever I try to run a simple PHP script to connect to
the same DSN, I am getting the following error,

 

Connection failed: SQLSTATE[08S01] SQLConnect: 20009 [unixODBC][FreeTDS][SQL
Server]Unable to connect: Adaptive Server is unavailable or does not exist

 

Everything seems to be setup correctly so I am lost. Here are my files that
I am using.

 

ODBC.INI

[ODBC Data Sources]

TESTCON = MSSQL Test

 

[TESTCON]

Driver               = FreeTDS

Description       = Test database connection

Trace               = No

Servername      = MSSQL

Database          = TESTCON

UID                 = blah

PWD               = blah

 

[Default]

Driver          = FreeTDS

 

ODBCINST.INI

[FreeTDS]

Description       = The FreeTDS driver library

Driver               = /usr/local/freetds/lib/libtdsodbc.so

Setup               = /usr/local/freetds/lib/libtdsodbc.so

 

FREETDS.CONF

 [global]

            tds version = 4.2

 

 [MSSQL]

            host = stored.host.name.from./etc/hosts

            instance = SQLEXPRESS

            port = 1433

            tds version = 8.0

 

ODBCTEST.PHP

try {

            $dbh = new PDO('odbc:LIBERT', 'sa', 'sa');

 

            //Execute the statement.

            $sth = $dbh->prepare("SELECT * FROM GLAFS",
array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));

            $sth->execute();

            $result = $sth->fetchALL();

 

            print_r($result);

            

            $dbh = NULL;

}

catch(PDOException $e) {

            echo 'Connection failed: '.$e->getMessage();

}

 

Any help would be great! Thanks a lot

 

Craig

            




More information about the FreeTDS mailing list