From: Adam Haberlach <adam@newsnipple.com>
To: Deniz Hastorun <denizh@itu.edu.tr>
Cc: pgsql-interfaces@postgreSQL.org
Subject: Re: problem connecting with libpq++ interface
Date: Tue, 10 Oct 2000 00:42:12 -0700
Message-ID: <20001010004212.C3506@ricochet.net> (raw)
In-Reply-To: <000d01c031ce$9ed29a00$25054ba0@cc.itu.edu.tr>
References: <000d01c031ce$9ed29a00$25054ba0@cc.itu.edu.tr>
On Mon, Oct 09, 2000 at 11:55:05AM +0300, Deniz Hastorun wrote:
>
> Hi everybody,
>
> I have a really strange problem . I'm trying to connect to PostgreSQL db
> from witin my C++ program and using the libpq++ interface functions . But
> strangely it won't connect and I'm receiving the following error message
>
> connection to db failed.
> Error returned:ERROR: PQconnectdb() - Missing '=' after 'template1' in
> conninfo
>
> .here's my code
> PGconn *conn1;
> const char * dbname="template1";
> PgDatabase data(dbname);
> conn1=PQconnectdb(dbname);
> if (data.ConnectionBad())
> {
> cerr<<" connection to db failed."<< endl
> <<" Error returned:" << data.ErrorMessage() << endl;
> exit(1);
> }
>
> any idea would be appreciated. thanks in advance!
I think you mean
const char * dbname="dbname=template1";
(and you don't need to do the PQconnectdb() , because the PgDatabase
object will make the connection for you...)
...hope this helps...have a nice day...
--
Adam Haberlach | A billion hours ago, human life appeared on
adam@newsnipple.com | earth. A billion minutes ago, Christianity
http://www.newsnipple.com | emerged. A billion Coca-Colas ago was
'88 EX500 | yesterday morning. -1996 Coca-Cola Ann. Rpt.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: adam@newsnipple.com, denizh@itu.edu.tr
Subject: Re: problem connecting with libpq++ interface
In-Reply-To: <20001010004212.C3506@ricochet.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox