CDbConnection.connectionString cannot be empty.

Trying to create a new app using mysql, used sqlite for the demo and had no problems. Changed main.php to:

	'db'=>array(


                    'class'=>'CDbConnection',


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


                    'username'=>'eitilteuser',


                    'password'=>'4Ks%acG1Fu',


                    'emulatePrepare'=>true,


	),

when I invoke the model command in the shell I get:

exception ‘CDbException’ with message ‘CDbConnection.connectionString cannot be empty.’ in /Users/dennisoconnor/yii-1.0.9.r1396/framework/db/CDbConnection.php:238

Using a terminal window I can connect to mysql and see the tables within the Eitilte database.

I can’t figure out why it thinks connectionString is empty.

I’m working on a MacBook Pro using Snow Leopard and it native PHP 5.3.0 environment

phpinfo(); shows:

PDO

PDO support enabled

PDO drivers mysql, sqlite, sqlite2

pdo_mysql

PDO Driver for MySQL enabled

Client API version mysqlnd 5.0.5-dev - 081106 - $Revision: 1.3.2.27 $

Persistent cache enabled

put_hits 0

put_misses 0

get_hits 0

get_misses 0

size 2000

free_items 2000

references 2

Directive Local Value Master Value

pdo_mysql.cache_size 2000 2000

pdo_mysql.default_socket /var/mysql/mysql.sock /var/mysql/mysql.sock

any help would be greatly appreciated.

Dennis

Is that the entire contents of main.php? If that is the case, you have to put the ‘db’ key under the ‘components’ array:


'components' => array(

'db'=>array(

'class'=>'CDbConnection',

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

'username'=>'eitilteuser',

'password'=>'4Ks%acG1Fu',

'emulatePrepare'=>true,

),

)

I just showed the db array. It is part of the components array.

Thanks for the response!

No problem, but wow. That’s really weird.

Uh… are you sure you’re editing the correct file? xD I actually did that the other day (editing the wrong file, I mean). Anyway, I don’t think there are any problems with your MySQL installation. If there were, I’m pretty sure you’d get other kinds of errors. I’d just try to figure out if there’s something wrong with the application structure or something like that.

I’m sorry that I couldn’t help you.

I’m feeling pretty foolish. I’m new to Netbeans and Subversion. I was editing a file in Netbeans and running the shell against a different directory. I very sorry if I wasted yours or anyone’s time chasing a non-problem. Every thing is working just fine now that I’m working against the right set of files.