Can't Access To Module Generator Page Of Gii!

Hi All,

I got the error "Error 500 CDbCommand failed to execute the SQL statement: SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected" when I tried to access to the Model generator page of GII.

Actually, I don’t know why, please kindly share the solution for the error!

Please refer some configurations below:


'modules'=>array(

    'gii'=>array(

        'class'=>'system.gii.GiiModule',

        'password'=>'123456',

        'ipFilters'=>array('127.0.0.1','::1'),

        ),

    ),


'db'=>array(

            'class'=>'CDbConnection',

            'connectionString'=>'mysql:host=localhost;db=test',

            'username'=>'root',

            'password'=>'',

            'emulatePrepare'=>true,

            'charset'=>'utf8',

            'active'=>true,

        ),


;extension=php_mbstring.dll

;extension=php_exif.dll      ; Must be after mbstring as it depends on it

extension=php_mysql.dll

extension=php_mysqli.dll

;extension=php_oci8.dll      ; Use with Oracle 10gR2 Instant Client

;extension=php_oci8_11g.dll  ; Use with Oracle 11gR2 Instant Client

;extension=php_openssl.dll

;extension=php_pdo_firebird.dll

extension=php_pdo_mysql.dll

;extension=php_pdo_oci.dll

;extension=php_pdo_odbc.dll

I’m using:

1-OS: window 7

2-Web server: xampp 3.2.1

3-browser: chrome

4-Yii: 1.1.13

Thanks in advance!

[size=2]Nothing seems to be wrong here with your configuration.Are you able to execute any query command in your project or not. If it is also creating problem then might be there is some mis-configuration in your xampp server. You should have to check it again.[/size]

This error is pointing that database is not selected for your given table name. But you have specified the database in your settings.Even though please check database again and also settings related to pdo on your xampp server.

Actually, I found where is my mistake. The configuration for database was wrong at the key of database name. It should be ‘dbname’, not ‘db’.

So the Gii can run now.

Hope it’s useful for you guys! Also thanks codesutra!