PQsetdbLogin

Prototypes

PGconn *PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions, const char *pgtty, const char *dbName, const char *login, const char *pwd);

Description

Etablit la connexion avec l'utilisateur login de mot de passe pwd sur le serveur phhost pour la base de données dbName.

Exemple

#include <server/pgtime.h>
#include <libpq-fe.h>
#include <libpq/libpq-fs.h>

static PGconn *hConnexion;

...
hConnexion=PQsetdbLogin("aix", NULL, NULL, NULL, "postgresql_aix", "scott", "tiger");
...
if (PQstatus(hConnexion)!=CONNECTION_OK)) ...
PQfinish(hConnexion);
...
if (PQstatus(hConnexion)!=CONNECTION_OK)) ...

Voir aussi

PQfinish pour se déconnecter.