Hi people,
I'm using some c++ code to connect to a postgresql 6.3.2 database.
I need to use this for a CGI application on a website we maintain.
It runs perfectly from the command line on my linux machine, and also
from the command line on the BSDI machine we use for a virtually-hosted
server.
The problem I'm having is when I attempt to execute it as a CGI app from
the cgi-bin directory on our server. Here's the code:
----------------------------------------------------------------------------
#include <iostream.h>
#include <libpq++.h>
#include <stdlib.h>
main()
{
cout << "Content-type: text/plain\n\n";
cout << "Trying to connect ..." << endl;
char* dbName = "molinks";
PgEnv Env;
Env.Host("peculiarweb.com");
// Env.Port("");
// Env.Auth("");
cout << "Env.Auth = " << Env.Auth() << endl;
cout << "Env.Host = " << Env.Host() << endl;
cout << "Env.Port = " << Env.Port() << endl;
cout << "Env.Option = " << Env.Option() << endl;
cout << "Env.TTY = " << Env.TTY() << endl;
// Open the connection to the database and make sure it's OK
PgDatabase data(Env, dbName);
if ( data.ConnectionBad() ) {
cout << "Connection was unsuccessful..." << endl
<< "Error message returned: " << data.ErrorMessage() << endl;
return 1;
}
else
cout << "Connection successful..." << endl;
----------------------------------------------------------------------------
When I try to run it as a CGI app from the web server, I get the
following error:
----------------------------------------------------------------------------
Trying to connect ...
Env.Auth =
Env.Host = peculiarweb.com
Env.Port =
Env.Option =
Env.TTY =
Connection was unsuccessful...
Error message returned: fe_setauthsvc: invalid name: , ignoring...
----------------------------------------------------------------------------
Anybody have any clue why this happens, or what it means? Better yet,
anybody know how to fix it?
----------------------------------------------------------------------------
Belinda & Clint Forgy
Midwest Online PeculiarWeb Internet Designs
http://www.midwestonline.com http://www.peculiarweb.com