Fatal error: CDbCommand.php (111)

Fatal error: Call to a member function prepare() on a non-object in ...frameworkdbCDbCommand.php on line 111

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

$cmd = $db->createCommand('select 1');

$srz = serialize(Yii::app()->getDb());

$cmd->prepare(); // ERROR!!!!!!!!!!!!!!!!

Why would you serialize db connection? When you do that, it will automatically disconnect the database and thus your command won't execute as expected.

I simply serialize state of my component, including dbConnection in it

You should avoid serializing resources.