Re: Help with pq++

From: Patrick Welche <prlw1(at)newn(dot)cam(dot)ac(dot)uk>
To: Aristide Aragon <aristide(at)lionking(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Help with pq++
Date: 2001-03-05 11:30:18
Message-ID: 20010305113018.D23726@quartz.newn.cam.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Feb 24, 2001 at 07:11:19PM -0600, Aristide Aragon wrote:
> Hello
> I need to make a program that uses pq++, before starting I made a little program to see if I understood correctly how to use pq++, however I have a problem: The program can't connect to the DB.
> My code looks like this:
> #include <stdio.h>
> #include <libpq++.h>
>
> int main()
> {
> PgDatabase db("dbname=mydb");
> if (!(db.ConnectionBad()))
> {
> printf("OK\n");
> exit(0);
> }
> else
> {
> printf("Error connecting\n");
> exit(1);
> }
> }
>
> And no matter what I do (I tried with the env variables PGHOST, PGPORT, PGDATABASE and PGUSER) the program always gives me "Error connecting".
> Can somebody help? I was expecting to have problems, but not this early.

You're right - that seems early. Can you connect to it with psql mydb?

Patrick

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Juan Ramón Cortabitarte 2001-03-05 12:17:18 RE: [PHP] How to connect to PostgreSQL with phpPgAdmi
Previous Message Daniel Kraemer 2001-03-05 10:38:23 Re: How to automatically start postmastrer with TCP/IP support (-i option) ???