Re: problem connecting with libpq++ interface

Поиск
Список
Период
Сортировка
От Adam Haberlach
Тема Re: problem connecting with libpq++ interface
Дата
Msg-id 20001010004212.C3506@ricochet.net
обсуждение исходный текст
Ответ на problem connecting with libpq++ interface  ("Deniz Hastorun" <denizh@itu.edu.tr>)
Список 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.


В списке pgsql-interfaces по дате отправления:

Предыдущее
От: nicolas boretos
Дата:
Сообщение: ODBC w/ 7.02
Следующее
От: Cedar Cox
Дата:
Сообщение: Re: Driver or Postgres doesn't report refer. integr. errors