*/ 'db'=>array( 'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db', ), // uncomment the following to use a MySQL database /* 'db'=>array( 'connectionString' => 'mysql:host=localhost;dbname=testdrive', 'emulatePrepare' => true, 'username' => 'root', 'password' => '', 'charset' => 'utf8', ), */
In the code above shows the application to connect to SQLite database where there are no tag "comment" while in MySQL there is a tag "comment" which means the code will not be processed. We need to do is
- Adding a tag comment / * and * / on SQLite SQLite database that is not executed. Consider the following code:
/* 'db'=>array( 'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db', ), */
- Remove the tag comment / * and * / to MySQL database and rename testdrive.db (default) with the name of your database. example yiicode_db
// Using MySQL database 'db'=>array( 'connectionString' => 'mysql:host=localhost;dbname=yiicode_db', 'emulatePrepare' => true, 'username' => 'root', 'password' => '', 'charset' => 'utf8', ),
/* 'db'=>array( 'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db', ), */ // Using MySQL database 'db'=>array( 'connectionString' => 'mysql:host=localhost;dbname=yiicode_db', 'emulatePrepare' => true, 'username' => 'root', 'password' => '', 'charset' => 'utf8', ),