Hi Any body Know How connect multiple database connection
Hi Any body Know How connect multiple database connection
in your config
'db2' => array(
'class' => 'CDBConnection',
'connectionString' => 'mysql:host=localhost;dbname=db2',
'username' => 'root',
'password' => '',
'charset' => 'utf8'
)
then anywhere
$command = Yii::app()->db2->createCommand($sql);
thanks for your info
Also note that you can set the database in the model by overriding the getDbConnection() method. This allows you to transparently use multiple databases without your controllers and such having to be aware.
Thanks I solved that problem