Connecting to postgresql

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


What are the other options of your DB component… what error are you getting ?

This is my working config




	'connectionString' => 'pgsql:host=localhost;port=5432;dbname=postgres',





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

"could not find driver"

did you check the yii requirements ?

Check under the PDO postgres extension

1 Like

thanks mdomba,

i made a mistake to assume the warning.

fixed everything in php configuration file and everything is ok.

thanks again.

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