kindvinnie
(Kindvinnie)
1
hallo evryone,
am trying to connect to postgresql and generate model but seems not going thru.
could anyone help me on how to establish a connection to postgresql.
i use this connection string:‘connectionString’ => ‘pgsql:host=localhost;port=5432;dbname=trackstar;’,
it generates an error for at this line:if(Yii::app()->db===null)
i have also tried to include user and password in connection string but in vain
regards
mdomba
(Maurizio Domba Cerin)
2
What are the other options of your DB component… what error are you getting ?
This is my working config
'db'=>array(
'tablePrefix'=>'',
'connectionString' => 'pgsql:host=localhost;port=5432;dbname=postgres',
'username'=>'postgres',
'password'=>'postgres',
'charset'=>'UTF8',
),
kindvinnie
(Kindvinnie)
3
hi mdomba,
i have tried that but doesnt work for me
it gives me this error:CDbConnection failed to open the DB connection: could not find driver
am using Yii 1.1.8
any help
mdomba
(Maurizio Domba Cerin)
4
"could not find driver"
did you check the yii requirements ?
http://www.yiiframework.com/doc/guide/1.1/en/quickstart.installation#requirements
Check under the PDO postgres extension
1 Like
kindvinnie
(Kindvinnie)
5
thanks mdomba,
i made a mistake to assume the warning.
fixed everything in php configuration file and everything is ok.
thanks again.
yaasky
(Xigbanam)
6
I ran into this problem myself, and this is how I solved mine.
Make sure that the php_pdo_pgsql extension is enabled in your php.ini file
Cheers