Re: Re: Help with pq++

Поиск
Список
Период
Сортировка
От Jose Manuel Lorenzo Lopez
Тема Re: Re: Help with pq++
Дата
Msg-id 3A9FB13C.DA51B4A6@conti.de
обсуждение исходный текст
Ответ на Re: Help with pq++  (Aristide Aragon <aristide@lionking.org>)
Список pgsql-general

Aristide Aragon schrieb:

> OK, I got the problem sorted out. The error message I received was
> "Error Message: FATAL 1:  Database "mydb" does not exist in the
> system catalog." That makes sense, the machine running this program
> doesn't have a mydb database, however I set the enviroment variable
> PGHOST to some other computer (and I just tested if I run the program
> there it returns OK).
> While I won't be running this program over a network, I do would like
> to know what's going on. How would I do it so that my program accesses
> the DB in another host? The documentation said (or at least that's what
> I understood) to export the PGHOST variable to the address of that other
> machine. I'll be running my program web-based, if I wanted it to
> connect to some other host then, how'd I do it?

Hello Aristide,

You can pass the hostname of the machine you want to connect to as
parameter when starting the program accesing the variables argv and
argc.

You have to define the main-function this way
int main(int argc, char *argv[])

and then pass the variables argc and argv to the constructor of the
PG-interface when creating the object.

TIP: If you are already using C++ you may want to create a class that
handles the DB-connections. You can save there the actual connection
parameters and create there connection string to pass to the contructor
of PgDatabase. That's the way I do it. :)

Best Regards / Un saludo / Mit freundlichen Grüßen / Cordiali Saluti

José Manuel Lorenzo López

--
**********************************************************************
** José Manuel Lorenzo López                                        **
**                                                                  **
** ICA Informationssysteme Consulting & Anwendungsgesellschaft mbH  **
** Dept. SAP Basis R/3  VBue                                        **
**                                                                  **
** e-mail to: jose-manuel.lorenzo-lopez@conti.de                    **
**********************************************************************

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Trigger Blunder
Следующее
От: "Richard Huxton"
Дата:
Сообщение: Re: user/group creation privileges