How Can I Connect Mysql And Remote Mssql Database (Two Database)


How can i connect to two database, mysql and remote mssql.

How can I connection config file distinguish between and how can call connection.

Thank you…

Follow all the steps in this wiki article.

Inside components array…

you can have like this

Here [size=2] is remote server and localhost is[/size]




		'connectionString' => ';dbname=wb_admin',

		'emulatePrepare' => true,

[size=2] [/size][size=2]‘username’ => ‘root’,[/size]

		'password' => '',

		'charset' => 'utf8',



		'connectionString' => 'mysql:host=;dbname=address',

		'emulatePrepare' => true,

		'username' => 'root',

		'password' => '',

		'charset' => 'utf8',

		'class'   => 'CDbConnection'


In you model

you have to override this method like this

public function getDbConnection()


	return Yii::app()->addressdb;


Then it will start to work :) cheers…