Newbie question on MDB2 error handling

Newbie question on MDB2 error handling

am 31.05.2009 17:01:50 von pascal

Hello all,

I am quite new to php and especially MDB2 package. Despite some thorough
research I could not find an answer yet.
When I try to connect to a database using MDB2::connect method, and the
database server is not running, I only get an
error code of -1 and a message saying "MDB2 Error: unknown error". Looking
at MDB2 source it rather should say "connect failed" with a code of -24
(MDB2_ERROR_CONNECT_FAILED). Is my expectation wrong, or how can I get
some meaningful message and error code in this situation?

The code I use is:

$dsn = "mysqli://mysql:mysql@127.0.0.1/MYDB"; // This works when mysql
server is running
$con = & MDB2::connect($dsn);

if(MDB2::isError($con))
{
print_r($con->getCode());
print_r($con->getMessage());
}

Any hint is warmly appreciated!

Thanks,

Pascal.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php