坑爹的Yii对oracle的支持

首先感谢这篇文章:http://ihacklog.com/post/how-to-connect-to-two-or-more-databases-simutaneously.html

在他的帮助下,我成功配置了第二个连接,然后在一没有pdo经验,二没有在Yii下用过oracle的情况下,一点点摸索前进。

在成功连接oracle后,遇到一个天大的问题:The table "xxxx.tablename" for active record class "MyClass" cannot be found in the database。

我找了一个多小时,反复试验,就是找不到。我试图修改tnsnames.ora,未果。去掉点前面的xxxx,也不行。

如果直接使用sql,是可以的:

$sql="select * from xxxx.tablename";
$user=Yii::app()->db_oracle->crateCommand($sql)->queryAll();

 

百思不得其解。最后只好回过头来看yii的文档:

http://www.yiiframework.com/wiki/99/using-yii-with-oracle-through-pdo/#hh3

Names case-sensitivity

Column names in Oracle are case-sensitive. This means that if you use all uppercase characters when creating a table (common behaviour among Oracle developers) and then try to access it with model and ActiveRecord for example like this:

Names case-sensitivity
Column names in Oracle are case-sensitive. This means that if you use all uppercase characters when creating a table (common behaviour among 
Oracle developers) and then try to access it with model and ActiveRecord for example like this:... ...

 

我试着把表名改为正确的大小写,通过了。

尼玛。。。

posted on 2012-08-02 20:30  anjo  阅读(2332)  评论(1编辑  收藏  举报