CDbException

CDbConnection failed to open the DB connection: SQLSTATE[HY000] [1049] Unknown database 'test'

/home/test/web/yii/framework/db/CDbConnection.php(382)

370                 throw new CDbException('CDbConnection.connectionString cannot be empty.');
371             try
372             {
373                 Yii::trace('Opening DB connection','system.db.CDbConnection');
374                 $this->_pdo=$this->createPdoInstance();
375                 $this->initConnection($this->_pdo);
376                 $this->_active=true;
377             }
378             catch(PDOException $e)
379             {
380                 if(YII_DEBUG)
381                 {
382                     throw new CDbException('CDbConnection failed to open the DB connection: '.
383                         $e->getMessage(),(int)$e->getCode(),$e->errorInfo);
384                 }
385                 else
386                 {
387                     Yii::log($e->getMessage(),CLogger::LEVEL_ERROR,'exception.CDbException');
388                     throw new CDbException('CDbConnection failed to open the DB connection.',(int)$e->getCode(),$e->errorInfo);
389                 }
390             }
391         }
392     }
393 
394     /**

Stack Trace

#7
+
 /home/test/web/protected/models/MailTemplates.php(124): CActiveRecord->find(array("condition" => "code=:code", "params" => array(":code" => "admin_exception_run_action")))
119 //     }
120     
121     public function getTemplate($code){
122         return $this->find(array(
123                 'condition'=>'code=:code',
124                 'params'=>array(':code'=>$code),
125             ));
126     }    
127     
128 //     public function setAsInvitationTemplate($invitationType){
129 //         $id = Yii::app()->db->createCommand()
#8
+
 /home/test/web/protected/components/MailSender.php(10): MailTemplates->getTemplate("admin_exception_run_action")
05      * TODO design the invitation mail body
06      */
07     
08     public static function renderMailTemplate($code, $to, array $params){
09         
10         $template_model = MailTemplates::model()->getTemplate($code);
11 
12         if(empty($template_model)){
13             Yii::trace('Missing mail template ' . $code);
14             return;
15         }
#9
+
 /home/test/web/protected/components/Controller.php(356): MailSender::renderMailTemplate("admin_exception_run_action", array("notifications@rcherz.com", "dohan.rene@gmail.com"), array("code" => 1049, "class" => "CDbException", "message" => "CDbConnection failed to open the DB connection: SQLSTATE[HY000] ...", "file" => "/home/test/web/yii/framework/db/CDbConnection.php", ...))
351 
352             if (!Yii::app()->user->isGuest && Yii::app()->user->id == 'dde1651a') {
353                 //TODO My errors got mixed up with user errors, no need to send e-mails for mine, feel free to remove this block later
354             }
355             else{
356                 MailSender::renderMailTemplate('admin_exception_run_action', array('notifications@rcherz.com', 'dohan.rene@gmail.com'), $params);
357             }
358 
359             throw $e;
360 
361         }
2024-03-28 22:27:17 nginx/1.18.0 Yii Framework/1.1.15