CDbException pesky problem

Hey folks,

I'm still trying to figure out my way around Yii so please forgive me if this is a simple thing to fix. I tried looking for similar problems in past threads but couldn't find anything.

I have recurring CDbException errors while trying to display list and admin tasks from a table. It keeps saying "The table "Call_query" for active record class "Call_query" cannot be found in the database.", while this is how the table is called and spelt. What's annoying is those are not only transient, they're also solved by refreshing the page a couple of times. Trouble is you have to press F5 for every page view so I'm at loss figuring out what is going on.

If that helps, here's my db setting in main.php

            'db'=>array(


         	'class'=>'CDbConnection',


         	'emulatePrepare' => true,


         	'autoConnect' => true,


         	'persistent' => true,


		'connectionString'=>'mysql:host=localhost;dbname=mydb;',


                'username'=>'myun',


                'password'=>'mypw',


	    ),

I would have thought setting the database connection as persistent would help prevent this sort of thing but it doesn't seem to be the case.

Anyone had similar problems and if so how did you work around it?

Thanks for any help :)

I think it has something to do with your database version and the version of PDO.

My suggestion is to remove the 'emulatePrepare' and 'persistent' settings. See how that goes.

Well I have MySQL 5.0.54 and the pdo_mysql driver that goes with it, so that seems pretty up-to-date to me.

I tried removing those settings from my config file but all it managed to do is create a new CDbException:

Quote

CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 2030 This command is not supported in the prepared statement protocol yet

Having said that, I don't seem to have that problem this morning, I wonder if it was linked to my browser's session somehow…

Not sure how browser caching would affect this. Maybe restart your MySQL instance and delete your cookies/cache on your browser to test. Or use a different browser for testing (i.e. Chrome).

I did a little research on this. I know this is old, but read this http://netevil.org/b…using-pdo-mysql. Not having seen exactly what you’re attempting to do which causes this error, I can’t say exactly what the problem may be. Appears to be centered around LOCK TABLES. Also looks to be a linux-only issue.

Looks like the emulatePrepare may be required, however, to do what you're trying to do.

You might also consider upgrading your MySQL version and client libraries.

Hope this helps, good luck.

Maybe this might help: http://forums.mysql…2,117710,117710