Thread: PQconnectdb question

PQconnectdb question

From
Christian Valverde
Date:
could somebody show me a little example on this function 
i have this parametersPQconn connection;char *user;char *passw;char *db;char *server;char *port;

user="chrisvv";
passw="mypass";
db="sales";
server="192.168.1.1";
port="5432";is it right to do as follows
connection=PQconnectdb(user,passw,db,server,port);
.... how is the correct form of making a conection with user and passwd  
parameters?


Re: PQconnectdb question

From
Christoph Haller
Date:
>
> could somebody show me a little example on this function
> i have this parameters
>       PQconn connection;
>       char *user;
>       char *passw;
>       char *db;
>       char *server;
>       char *port;
>
> user="chrisvv";
> passw="mypass";
> db="sales";
> server="192.168.1.1";
> port="5432";
>  is it right to do as follows
> connection=PQconnectdb(user,passw,db,server,port);
> .... how is the correct form of making a conection with user and
passwd
> parameters?
>
>
connection=
PQconnectdb("user=chrisvv password=mypass dbname=sales
hostaddr=192.168.1.1 port=5432");

should work.
You may want to refer to
$PGSQLD/doc/html/libpq-connect.html

Regards, Christoph