Hi,
Is there a way to change the default db connection for a particular controllers actions. I want to switch between two database connection in my action, how do I do it ?
I have configured both the database in my main.php file, like:
'db'=>array(
'connectionString' => 'mysql:host=1.1.1.1;dbname=mydb',
'emulatePrepare' => true,
'username' => 'root',
'password' => '1111',
'charset' => 'utf8',
),
'db2'=>array(
'class'=>'CDbConnection',
'connectionString' => 'mysql:host=2.2.2.2;dbname=mydb',
'emulatePrepare' => true,
'username' => 'root',
'password' => '2222',
'charset' => 'utf8',
),
How do I switch between these two database connection in my controller's action ?