pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedproblem connecting with libpq++ interface
2+ messages / 2 participants
[nested] [flat]
* problem connecting with libpq++ interface
@ 2000-10-09 08:55 Deniz Hastorun <denizh@itu.edu.tr>
2000-10-10 07:42 ` Re: problem connecting with libpq++ interface Adam Haberlach <adam@newsnipple.com>
0 siblings, 1 reply; 2+ messages in thread
From: Deniz Hastorun @ 2000-10-09 08:55 UTC (permalink / raw)
To: pgsql-interfaces
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!
deniz
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: problem connecting with libpq++ interface
2000-10-09 08:55 problem connecting with libpq++ interface Deniz Hastorun <denizh@itu.edu.tr>
@ 2000-10-10 07:42 ` Adam Haberlach <adam@newsnipple.com>
0 siblings, 0 replies; 2+ messages in thread
From: Adam Haberlach @ 2000-10-10 07:42 UTC (permalink / raw)
To: Deniz Hastorun <denizh@itu.edu.tr>; +Cc: pgsql-interfaces
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.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2000-10-10 07:42 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-10-09 08:55 problem connecting with libpq++ interface Deniz Hastorun <denizh@itu.edu.tr>
2000-10-10 07:42 ` Adam Haberlach <adam@newsnipple.com>
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