What does "pgoptions" should contain in C - function PQsetdb - Mailing list pgsql-admin

From Monika Farkasova
Subject What does "pgoptions" should contain in C - function PQsetdb
Date
Msg-id Pine.LNX.3.96.981209190040.30967B-100000@alfa.intrak.tuke.sk
Whole thread Raw
List pgsql-admin
Hello,

I work with postgresql-6.3.2-10 on Linux Redhat 5.2

In simple example of database connection in C-language (in
documentation) you set the pgoptions=NULL. It works.

How cat I say to function
PQsetdb(char * pghost, char * pgport, char *pgoptions, char * pgtty,
     char * dbName);
that I want to connect database  as user=someone and with password=
something.

example:

char *pghost, *pgport, *pgoptions, *pgtty, *dbName;

pghost="hron.fei.tuke.sk";
pgport="5432";
pgoptions="??????????";
pgtty=NULL;
dbName="student"

PQsetdb(pghost,pgport,pgoptions,pgtty,dbName);


What does the "pgoptions" contain and what is the syntax instead of NULL.

In dba.conf I have set the password passwordfile.

I tryed to use the syntax of  PHP function for postgres:
    pg_Connect("dbname=db user=someone password=something");

in C function as:
         PQsetdb("dbname=db user=someone password=something");

but it does not work.

I can not use the PQOPTION in psql, too.

    Monika Farkasova




pgsql-admin by date:

Previous
From: Frederic Nourry
Date:
Subject: Database Security
Next
From: LAU ENG HUAT
Date:
Subject: When will I receive my update CD for Postgre 6.4