Use ActiveRecord with Synonyms

Hi,

Can activereord work with synonym? Since I got the error message:




The table "P8_STORE" for active record class "Store" cannot be found in the database. 



My access id have update, delete, insert and select permissions, but it does not have DBA rights. Is there any other privileges need to be assigned in order to use active record?

I tried with another account which has the DBA rights, the connection succeed. But we are not supposed to use that account in the application since it can drop/create table. Once I change back to my user’s account (CRUD rights only), without changing any code, it failed. The exception was thrown at:

CActiveRecordMetaData::_construct($model):

if(($table=$model->getDbConnection()->getSchema()->getTable($tableName))===null)

Anyone knows what is the problem?

Please help!

CActiveRecord performs the two following queries:




SHOW CREATE TABLE tableName

SHOW COLUMNS FROM tableName



I didn’t work with synonyms, so I can’t help you much there.

I found out the solution is to use defaultSchema name, i.e. set it to be my table owner name.

But I am not sure whether this is the secure way to by pass the permission restriction?

If you turn on schema caching and set a long duration Yii will not run those queries.

No, I did not turn on schema caching. Does that mean if I turn on caching, I should be able to query using the account which can only access synonyms (CRUD permissions only)?