Newbie question on MDB2 error handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx/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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux