Skip to Content.
Sympa Menu

freetds - [freetds] (no subject)

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Craig Metrolis" <craigmetrolis AT medicinechestrx.com>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] (no subject)
  • Date: Tue, 23 Dec 2008 14:06:16 -0600

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






  • [freetds] (no subject), Craig Metrolis, 12/23/2008

Archive powered by MHonArc 2.6.24.

Top of Page