How to manage multiple Databases and Schemas using YII framework

Hi all,

I read the articles about managing multiple Databases with yii framework, but they all lack of scalability (bad programing) or they can only access a specific database that we pretend (one at a time).

What i want is to get all the information from at least 2 Databases (select *) in different schemas, at simultaneous. Like a merge of the results of the DB’s.

If someone could help me i would apreciate.

Thank you

i managed to do it but it lacks in scalability. If i want to add a new DB i have to change a lot of files .php

I want to use yii in developing of my company’s erp system but lacking of this feature preventing me, I hope that it will be exist in 2.0

maybe you should try this solution:

in short:










            'emulatePrepare'=>true,  // needed by some MySQL installations











and then iterate through all application components:

 foreach(Yii::app()->getComponents() as $component)

  if ($component instanceof CDbConnection) 




     //merge results...



solved :)

how you done this ? i also want to do this


I did do it but its not working with two DBs simultaneous. I configured 2 DBs (like redguy did above) and query them one each time.

True its not efficient like i was looking for but it works :)

in short its like:

What i wanted:

SELECT * FROM users,projects

What i did to work:

[b]SELECT * FROM users

SELECT * FROM projects[/b]