Yii Framework Forum: gii Model Generator CDbConnection error - Yii Framework Forum

Jump to content

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

gii Model Generator CDbConnection error SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected. Rate Topic: -----

#1 User is offline   haodoudo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 13-July 12

Posted 16 July 2012 - 01:39 PM

Hi,

Following the tutorial, I've reached the step to generate the model code. When I click on the Model Generator link in gii, I get the following error:

CDbCommand failed to execute the SQL statement: SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected. The SQL statement executed was: SHOW TABLES

This is my db config on main.php:

'db'=>array(
'connectionString' => 'mysql:host=127.0.0.1;port:3306;dbname=test',
'emulatePrepare' => true,
'username' => 'root',
'password' => 'removed_password',
'charset' => 'utf8',
),


And this is my Yii requirement check result:

Attached File  Screen Shot 2012-07-16 at 11.35.33 AM.png (174.05K)
Number of downloads: 29

I've searched this forum and others but have not been able to find anything to help me get pass this point.

Help!

Attached File(s)


0

#2 User is offline   yugene 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 513
  • Joined: 08-August 09

Posted 16 July 2012 - 10:59 PM

The clue point is: No database selected.
Please check you specified correct db name first of all, then all your connectionString is set correctly.
0

#3 User is offline   Benjamin Bellamy 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 01-November 12

Posted 01 November 2012 - 12:34 PM

I had the exact same problem.
It turned out to be a typo mistake: "port:3306" instead of "port=3306".

Ben.

View Posthaodoudo, on 16 July 2012 - 01:39 PM, said:

'db'=>array(
'connectionString' => 'mysql:host=127.0.0.1;port:3306;dbname=test',
'emulatePrepare' => true,
'username' => 'root',
'password' => 'removed_password',
'charset' => 'utf8',
),

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