Re: MDB2 and MSSQL

From: Date: Tue, 03 Apr 2007 07:40:50 +0000
Subject: Re: MDB2 and MSSQL
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-26983@lists.php.net to get a copy of this message
Anyone who knows how to connect? On 2/5/07, Louie Miranda <lmiranda@gmail.com> wrote:
I am trying to connect and get a query of a MSSQL database (using sql express edition). My simple code for connecting is.. <?php require_once 'MDB2.php'; $dsn = 'mssql://louie:louie@192.168.10.90/Calendars'; $mdb2 =& MDB2::factory($dsn); if (PEAR::isError($mdb2)) {
    echo ($mdb2->getMessage().' - '.$mdb2->getUserinfo());
} $query ='select * from CalendarEvents'; // run the query and get a result handler $result = $mdb2->query($query); print("<pre>"); //print_r($mdb2); print("</pre>"); print("<pre>"); print_r($result); print("</pre>"); // check if the query was executed properly if (PEAR::isError($result)) {
    echo ($result->getMessage().' - '.$result->getUserinfo());
    exit();
} // lets just get row:0 and free the result $array = $result->fetchRow(); $result->free(); var_dump($array); ?> But the error i receive is... [code] => -24
     [message] => MDB2 Error: connect failed
     [userinfo] => connect: [Error message: unable to establish a connection]
From the sql management studio express, i can connect without this error. All i want to know is how can i debug more the MSSQL connection? Since unable to establish a connection is very general. Please help! -- Louie Miranda (lmiranda@gmail.com) http://www.axishift.com //JSM-W
-- Louie Miranda (lmiranda@gmail.com) http://www.axishift.com //JSM-W

« previous php.pear.general (#26983) next »