Jump to content
Larry Ullman's Book Forums

manish23

Members
  • Posts

    1
  • Joined

  • Last visited

manish23's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. 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 ?
×
×
  • Create New...