Newbie question on MDB2 error handling

From: Date: Sun, 31 May 2009 15:01:50 +0000
Subject: Newbie question on MDB2 error handling
Groups: php.db 
Request: Send a blank email to php-db+get-46214@lists.php.net to get a copy of this message
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.

« previous php.db (#46214) next »