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 **
**********************************************************************