public function validateConnection()
    {
        // Make sure all fields are provided
        if ($this->validate())
        {
            // Just turning the connection on and off. A CDbException will be thrown if something goes wrong
            try
            {
                $connection = new CDbConnection("mysql:host={$this->host};dbname={$this->dbname}", $this->username, $this->password);
                $connection->setActive(true);
                $connection->setActive(false);
				$this->dsn = $connection->connectionString;
                return true;
            }
            catch (Exception $e)
            {
                // Add errors to all fields for the visual indicator
                $this->addError('username', '');
                $this->addError('password', '');
                $this->addError('dbname', '');
                $this->addError('host', '');
                
                $this->addError('dsn',Yii::t('Install.main', 'Unable to connect to database using the provided credentials.'));
                return false;
            }
        }
        $this->addError('dsn',Yii::t('Install.main', 'Unable to connect to database using the provided credentials.'));
        return false;
    }
public function validateConnection()
    {
        // Make sure all fields are provided
        if ($this->validate())
        {
            // Just turning the connection on and off. A CDbException will be thrown if something goes wrong
            try
            {
                $connection = new CDbConnection("mysql:host={$this->host};dbname={$this->dbname}", $this->username, $this->password);
                $connection->setActive(true);
                $connection->setActive(false);
				$this->dsn = $connection->connectionString;
                return true;
            }
            catch (Exception $e)
            {
                // Add errors to all fields for the visual indicator
                $this->addError('username', '');
                $this->addError('password', '');
                $this->addError('dbname', '');
                $this->addError('host', '');
                
                $this->addError('dsn',Yii::t('Install.main', 'Unable to connect to database using the provided credentials.'));
                return false;
            }
        }
        $this->addError('dsn',Yii::t('Install.main', 'Unable to connect to database using the provided credentials.'));
        return false;
    }
public function validateConnection ( ) { // Make sure all fields are provided if ( $ this -> validate ( ) ) { // Just turning the connection on and off. A CDbException will be thrown if something goes wrong try { $ connection = new CDbConnection ( "mysql:host={$this->host};dbname={$this->dbname}" , $ this -> username , $ this -> password ) ; $ connection -> setActive ( true ) ; $ connection -> setActive ( false ) ; $ this -> dsn = $ connection -> connectionString ; return true ; } catch ( Exception $ e ) { // Add errors to all fields for the visual indicator $ this -> addError ( 'username' , '' ) ; $ this -> addError ( 'password' , '' ) ; $ this -> addError ( 'dbname' , '' ) ; $ this -> addError ( 'host' , '' ) ; $ this -> addError ( 'dsn' , Yii :: t ( 'Install.main' , 'Unable to connect to database using the provided credentials.' ) ) ; return false ; } } $ this -> addError ( 'dsn' , Yii :: t ( 'Install.main' , 'Unable to connect to database using the provided credentials.' ) ) ; return false ; }
Validator for connection to MySQL
@return bool     Whether or not we could connect to MySQL
Validator for connection to MySQL