https://www.youtube.com/watch?v=EFtpHPvu3Xg
Dapet error kaya gini di yii, pas koneksi pake postgresql :
CDbConnection failed to open the DB connection: SQLSTATE[08006] [7] FATAL: no pg_hba.conf entry for host "::1", user "ambacom_k", database "ambacom_k", SSL off
error diatas ada tanda “::1” yang artinya ipv6, sedangkan web yang kita gunakan ipv4, jadi muncullah error seperti itu. Nah solusinya ubah setingan dbnya dari localhost menjadi 127.0.0.1 seperti dibawah :
return array( "pdoClass" => "NestedPDO", "connectionString" => "pgsql:host=127.0.0.1;port=5432;dbname=ambecom_k", "emulatePrepare" => true, "username" => "ambecom_k", "password" => "k", "charset" => "utf8", "tablePrefix" => "k_", );
abis itu refresh halaman webnya,….. eh malah dapet error baru lagi ..! 🙁
CDbConnection failed to open the DB connection: SQLSTATE[IM001]: Driver does not support this function: driver does not support setting attributes
solusiny, beri comment pada emulatePrepare => true
return array( "pdoClass" => "NestedPDO", "connectionString" => "pgsql:host=127.0.0.1;port=5432;dbname=ambacom_k", //"emulatePrepare" => true, "username" => "ambacom_k", "password" => "k", "charset" => "utf8", "tablePrefix" => "k_", );
reference : http://www.yiiframework.com/forum/index.php/topic/40629-postgresql-cannot-connect-using-127001/