relations (two databases)

Hello everyone.

I have two models which represent tables from different databases. They work ok but I get problem when I want to set relations between them. I get error that tells that table does not exist.

I tried this in my model

public function tableName()


	return 'database_2.shkoly';


But I get access error as connections to these databases use different users and passwords.

Please, can anybody help me?


From what I know you cannot make a relation to tables from different databases.

Is there another way to load necessary data to my dataprovider to use it in CGridView?

What if I use mysql temporary table to copy all the data from another database? Does Yii have tools to work with temporary tables?

I’ve used temporary table. Slower but works.

Better suggestions are welcome. :)

Check this thread… seems you can relate tables from different database -