Hello -
I am working on moving my WEB pages, which include searches in a PostgreSQL
data base, through "libpq".
Old system: Red Hat Linux 9, PostgreSQL 7.4.6
New system: Fedora 11, PostgreSQL 8.4
When I re-compile the program (using updated gnu C++ compilers/libs),
the new version --will-- connect to the data base if I run the CGI program
from the command line, but will --NOT-- connect if I call the CGI program
from a web page.
Here is the C/C++ code:
------------------------------
const char *pcDbArgs = "user=joela dbname=photodb port=5432
host=192.168.111.7";
const char *pcDbName = "photodb";
//
// Connect to PostGresQL data base....
//
printf("\nCalling PQconnectdb(%s)\n", pcDbArgs);
gpPhotoDb = PQconnectdb (pcDbArgs);
if (PQstatus(gpPhotoDb) != CONNECTION_OK)
vExit("Can't connect to database \"%s\" - %s\n", pcDbName,
PQerrorMessage(gpPhotoDb));
printf("Successful connection!\n\n");
(vExit is a simple function that formats an error message)
When run from an HTML page:
Error message:
------------------
Calling PQconnectdb(user=joela dbname=photodb port=5432 host=192.168.111.7)
*** Error - Can't connect to database "photodb" - could not connect to server:
Permission denied
Is the server running on host "192.168.111.7" and accepting
TCP/IP connections on port 5432?
I have verified that the postgresql server --is-- running on the server
machine, and --is-- listening on 5432.
I am sure I am leaving something out, so please write if you need more info.
Any thoughts?
Thanks!
Joel.
--
+--------------------------------------------------------------------+
| Joel K. Alpers
| Expressive Black and White Images
| http://www.jkalpers.com
+--------------------------------------------------------------------+
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general