Yii Framework Forum: CDbConnection.connectionString cannot be empty - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CDbConnection.connectionString cannot be empty Rate Topic: -----

#1 User is offline   roo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 11-December 08

Posted 11 December 2008 - 02:10 PM

I'm getting the error "CDbConnection.connectionString cannot be empty." when I have set it via ./protected/config/main.php...

Php Version is: PHP 5.2.6-2ubuntu4

I have *'d out my username and password for the database, but they do in fact work.


root@Sol20070001:/var/www/testdrive# mysql -u****** -p****** fatbastard
Reading table information for completion of table and column names 
You can turn off this feature to get a quicker startup with -A     

Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 123                         
Server version: 5.0.67-0ubuntu6 (Ubuntu)               

Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

mysql> desc Companies;
+-------------+------------------+------+-----+---------+----------------+
| Field      | Type            | Null | Key | Default | Extra          |
+-------------+------------------+------+-----+---------+----------------+
| idCompanies | int(10) unsigned | NO  | PRI | NULL    | auto_increment |
| Name        | varchar(255)    | NO  |    | NULL    |                |
+-------------+------------------+------+-----+---------+----------------+
2 rows in set (0.01 sec)                                                 

mysql> quit
Bye       
root@Sol20070001:/var/www/testdrive# cat ./protected/config/main.php
<?php                                                               

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
        'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
        'name'=>'FatBastard',

        // autoloading model and component classes
        'import'=>array(
                'application.models.*',
                'application.components.*',
        ),

        // application components
        'components'=>array(
                'user'=>array(
                        // enable cookie-based authentication
                        'allowAutoLogin'=>true,
                ),
                // uncomment the following to set up database
                /*
                'db'=>array(
                        'connectionString'=>'mysql:host=localhost;dbname=fatbastard','username'=>'******','password'=>'******'
                ),
                */
        ),
);
root@Sol20070001:/var/www/testdrive# ./protected/yiic shell
Yii Interactive Tool v1.0
Please type 'help' for help. Type 'exit' to quit.
>> model Companies
exception 'CDbException' with message 'CDbConnection.connectionString cannot be empty.' in /var/www/yii-1.0.0.r322/framework/db/CDbConnection.php:223
Stack trace:
#0 /var/www/yii-1.0.0.r322/framework/db/CDbConnection.php(208): CDbConnection->open()
#1 /var/www/yii-1.0.0.r322/framework/db/CDbConnection.php(187): CDbConnection->setActive(true)
#2 /var/www/yii-1.0.0.r322/framework/base/CApplication.php(710): CDbConnection->init()
#3 /var/www/yii-1.0.0.r322/framework/base/CApplication.php(361): CApplication->getComponent('db')
#4 /var/www/yii-1.0.0.r322/framework/cli/commands/shell/ModelCommand.php(92): CApplication->getDb()
#5 [internal function]: ModelCommand->generateModel('/var/www/yii-1....', Array)
#6 /var/www/yii-1.0.0.r322/framework/console/CConsoleCommand.php(116): call_user_func(Array, '/var/www/yii-1....', Array)
#7 /var/www/yii-1.0.0.r322/framework/cli/commands/shell/ModelCommand.php(72): CConsoleCommand->copyFiles(Array)
#8 /var/www/yii-1.0.0.r322/framework/cli/commands/ShellCommand.php(98): ModelCommand->run(Array)
#9 /var/www/yii-1.0.0.r322/framework/cli/commands/ShellCommand.php(78): ShellCommand->runShell()
#10 /var/www/yii-1.0.0.r322/framework/console/CConsoleCommandRunner.php(62): ShellCommand->run(Array)
#11 /var/www/yii-1.0.0.r322/framework/console/CConsoleApplication.php(88): CConsoleCommandRunner->run(Array)
#12 /var/www/yii-1.0.0.r322/framework/base/CApplication.php(146): CConsoleApplication->processRequest()
#13 /var/www/yii-1.0.0.r322/framework/yiic.php(30): CApplication->run()
#14 /var/www/testdrive/protected/yiic(8): require_once('/var/www/yii-1....')
#15 {main}
>> exit
root@Sol20070001:/var/www/testdrive#


Ideas?
0

#2 User is offline   anli 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 04-December 08
  • Location:Tver, Russian Federation

Posted 11 December 2008 - 03:17 PM

db component configuration is commented out.
0

#3 User is offline   roo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 11-December 08

Posted 11 December 2008 - 04:32 PM

DUH.... the text highlighing in the forum should have given it away..
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users