Developed with MYSQL v 5.5.8, web host has v 5.1.54

Hey guys,

I developed a website based on a mysql database version 5.5.8 … now that I wanted to put it on my server (which has mysql version 5.1.54) I get some errors … i figured out, that he is able to find the tables, if i write them with a upper case letter as first letter.

The exception is (sorry, its german): "Die Tabelle "Statistic" für die ActiveRecord-Klasse "Statistic" kann nicht in der Datenbank gefunden werden."

Stack trace:


/kunden/316499_70190/Yii/framework/db/ar/CActiveRecord.php(2237)


2225     private $_model;

2226 

2227     /**

2228      * Constructor.

2229      * @param CActiveRecord $model the model instance

2230      */

2231     public function __construct($model)

2232     {

2233         $this->_model=$model;

2234 

2235         $tableName=$model->tableName();

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

2237             throw new CDbException(Yii::t('yii','The table "{table}" for active record class "{class}" cannot be found in the database.',

2238                 array('{class}'=>get_class($model),'{table}'=>$tableName)));

2239         if($table->primaryKey===null)

2240             $table->primaryKey=$model->primaryKey();

2241         $this->tableSchema=$table;

2242         $this->columns=$table->columns;

2243 

2244         foreach($table->columns as $name=>$column)

2245         {

2246             if(!$column->isPrimaryKey && $column->defaultValue!==null)

2247                 $this->attributeDefaults[$name]=$column->defaultValue;

2248         }

I now could change all tables to start with an upper case letter, but thats a really bad solution I think … anyone had this error before? Where does it come from and how to solve it?

I guess it has something to do with the built in ORM Framework of Yii maybe?

Thanks for your help in advance,

Mayjestic

Check this documentation on mysql - http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html

I get this same exception intermittently at my hosting provider, on the "SHOW COLUMNS FROM …" call. MySQL 5.051a. As a matter of fact I did change my table names to lower case when preparing for multiple applications, by adding a prefix.

I created a minimal application




  ...

  $connection = Yii::app()->db;

  $sql = 'SHOW COLUMNS FROM {{item}}';

  $columnschema = $connection->createCommand($sql)->queryAll();

  ..



In this case I get other error messages from MySql (for example):

/Tommy

@tri your error is different… by the error I would say it’s some permission problems on the /tmp/ folder… as it say “cannot create/write to file /tmp/…”

The error occurs intermittently. I’m testing to access the db each tenth second, the error occurs perhaps 5-10 times in 24 hours.

/Tommy

check this discussion - http://www.oxwall.org/forum/topic/623

it could be some server config for the tmp folder… not enough space… or if on linux… maybe got out of free inodes… anyway you need to contact the server support for this…

@mdomba

Thanks! I might give hosting support a hint about this. (We already have an open case that I initiated a couple of months ago).

/Tommy

Thanks for your reply mdomba. Now I know that it’s not Yii, its the Unix System behind the webspace. Do you have any recommendation how to solve this issue the smartest and cleanest way? …

I guess 1 solution still would be, to rename all the tables … but I got a bad feeling with that :wink:

First check on server how is the option "lower_case_table_names" set - http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_lower_case_table_names

if set to 1 - comparison are not case-sensitive

Thanks a lot four your help mdomba. Turns out, that it’s not possible with the actual webspace :-/ … but finally i know where this issue comes from :slight_smile: