public function getDbConnection()
    {
        if (!Yii::app()->hasComponent($this->connectionID)) {
            throw new CException(sprintf('Connection component "%s" does not exist.', $this->connectionID));
        }
        $db = Yii::app()->getComponent($this->connectionID);
        if (!$db instanceof CDbConnection) {
            throw new CException(sprintf(
                'Connection component "%s" is not an instance of CDbConnection.',
                $this->connectionID
            ));
        }
        return $db;
    }