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

Hello,

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]id.phl.in is remote server and localhost is 127.0.0.1[/size]

[size=2]

[/size]

	'db'=>array(


		'connectionString' => 'mysql:host=id.phl.in;dbname=wb_admin',


		'emulatePrepare' => true,

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

		'password' => '',


		'charset' => 'utf8',


	),


	'addressdb'=>array(


		'connectionString' => 'mysql:host=127.0.0.1;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…