Hi, I am using Yii with PostgreSQL for the first time and I have a little difficulties in setting up the database on the hosting.
This is my config for the db :
'db'=>array(
'connectionString' => 'pgsql:host=localhost;port=5432;dbname=k39xxxxx_mwntest',
'emulatePrepare' => true,
'username' => 'k39xxxxx_mwnuser',
'password' => 'mypassword',
'tablePrefix' => '',
'charset' => 'utf8',
'enableProfiling' => true,
'enableParamLogging' => true
),
And it gets the error :
"CDbConnection failed to open the DB connection: SQLSTATE[08006] [7] FATAL: no pg_hba.conf entry for host "::1", user "k39xxxxx_owner", database "k3924916_dev", SSL off"
But when I try to connect manually it success. Below is the code when I try to connect manually :
$dbcon2 = new PDO("pgsql:dbname=k39xxxxx_mwntest;host=127.0.0.1", 'k39xxxxx_mwnuser', 'mypassword' );
if ($dbcon2) {
echo "Success!";
} else {
echo "Fail : ".mysql_error();
}
If I change "127.0.0.1" above to localhost, then it gets the same error :
"no pg_hba.conf entry for host "::1", user "k39xxxxx_owner", database "k3924916_dev", SSL off
So it seems like I have to use "127.0.0.1" to connect to the db. When I ask the hosting support, they say that the connection must use "127.0.0.1" instead of "localhost". But if I replace my config/main using 127.0.0.1, then it gets error :
"Driver does not support this function: driver does not support setting attributes"
What must I do ? Please help… Thanks