On 3/19/07, Jude Aakjaer <[EMAIL PROTECTED]> wrote:
I'm not sure if this is a related issue or a different one, but using the following code I cannot catch the failing exception try { $db = Zend_Db::factory($config->db->adaptor, array('host' => 'localhost', 'username' =>'noexistant', 'password' => 'failme', 'dbname' => 'random')); } catch (Exception $e) { echo "caught an exception! <br />"; echo $e->getMessage(); exit; } I keep getting Fatal error: Uncaught exception 'Exception' with message 'SQLSTATE[28000] [1045] Access denied for user 'nonexistant'@'localhost' (using password: YES)' Without the database name I can successfuly catch an exception telling me that the dbname key hasn't been filled in, but I seemingly cannot catch the "failed to connect to db" exception
Zend_Db_Adapter does not create a connection to the database when you create it. The "real" PDO Connection is created when you execute first query or create instance of Zend_Db_Table class. So, the try/catch block does not catch this exception just because it is fired later in the code, when the "real" connection is created. Sincerely, -- Alexander http://www.alexatnet.com/ - Blog and CMS created with Zend Framework and Ajax.