Changes
Title
unchanged
Multiple Databases and Multiple Domains
Category
unchanged
Tutorials
Yii version
unchanged
Tags
changed
database
Content
changed
[...]
'username' => 'root',
'password' => 'itsasecret',
'charset' => 'utf8',
),
'db2'=>array(
'class' => 'CDBbConnection',
'connectionString' => 'mysql:host=localhost;dbname=database2',
'emulatePrepare' => true,[...]
{
// Create CDbConnection and set properties
self::$db
= = new CDbConnection(
Yii::app()->db2->connectionString,Yii::app()->db2->username,Yii::app()->);
foreach(Yii::app()->db2 as $key => $value)
self::$db
2->
password)$key = $value;
// Uncomment the following lines to prove that you have two database connections
/*
CVarDumper::dump(Yii::app()->db);[...]