Berikut adalah cara setup connection dari framework Yii (1.1.13) ke database Mysql / SQL Server 2005.
Howto
1. Activate extension php pdo_mysql (for mysql database) or pdo_mssql (for sqlserver database) , if you don't have pdo for sql server download Here (i hope you know how to activate extension php)
2. Open your file in path Yiiproject/protected/config and see this 2 files :
- console.php and main.php
3. find string 'db' and equate the settings for 'db' :
for example you have Specification like this :
* Database : Sqlserver 2005 or Mysql
* Database Name : 'dbnew'
* Table : 'user_table'
* Field : ID (PK + AI) , name
and this is the correct settings :
for Mysql Database (required pdo_mysql) :
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=dbnew',
'emulatePrepare' => true,
'username' => 'xxx',
'password' => 'xxx',
'charset' => 'utf8',
),
for Sql Server 2005 Database (not tried another version) :
'db'=>array(
'connectionString' => 'mssql:server=localhost;dbname=dbnew',
'username' => 'xxx',
'password' => 'xxx',
),
Hope this helps :D
Post a Comment
Harap gunakan bahasa yang baik dan sopan, terima kasih