MDB2 and MSSQL
| From: | Louie Miranda | Date: | Mon, 05 Feb 2007 01:43:41 +0000 |
| Subject: | MDB2 and MSSQL | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-26497@lists.php.net to get a copy of this message | ||
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)) {But the error i receive is...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); ?>
[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