From: "Louie Miranda" on
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(a)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(a)gmail.com)
http://www.axishift.com

//JSM-W