Hi,
I am just trying to connect to a Postgresql DB using a Perl cgi script
from a web page from my own computer on a remote network.
I am using Postgresql 8.1.4 on Fedora Core 5 with a Linux firewall that
allows all traffic.
Postmaster is running with -i and I tried different -h (including *),
right now it is set to 127.0.0.1
In postgresql.conf, I have
listen_addresses='*'
port = 5432.
In pg_hba.conf I have:
local dbname
user md5
host dbname user xxx.xx.xx.x 255.255.255.255 md5
host dbname user 127.0.0.1/32 255.255.255.255 md5
host dbname user ::1/128 255.255.255.255 md5
In the real file, dbname, user and xxx.xx.xx.x are replaced by the
actual value (just in case!!). I also tried all all and trust. For user
there is a password set, and it works locally when I use psql to connect.
I tried different combination (e.g. only 127.0.0.1), like removing the
mask (255.255.255.255) etc. but nothing seems to work.
In the perl cgi script I have:
use DBI;
my $conn =
DBI->connect("DBI:Pg:dbname=dbname;host=127.0.0.1;port=5432;", "user",
"password",{ RaiseError => 1, AutoCommit => 0})|| die "Database
connection not made: $DBI::errstr";;
The error I get is:
DBI connect('dbname=dbname;host=127.0.0.1;port=5432;','user',...) failed: could not create socket: Permission denied
If I remove the host and port from the DBI->connect (which should not be done!) I get this error:
DBI connect('dbname=dbname;','user',...) failed: could not connect to server: Permission denied
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?