Connection refused from Java in Windows to remote postgresql Linux server
843854Feb 7 2004 — edited Jul 8 2004I fail to connect from windows to a remote postgresql linux server. The SQLEexception received is same as the SQLException that happen to the localhost connection to postgresql where the condition of postgresql not started or not start with -i option to allow tcp/ip connection. The SQLException is SQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
Please help..
Java class file with the following codes:
String url = "jdbc:postgresql://servername:5432/databasename";
Connection con = DriverManager.getConnection(url,"username","password");
The /var/lib/pgsql/data/pg_hba.conf have the following configuration:
# TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
local all all trust
host all all 127.0.0.1 255.255.255.255 trust
hostssl all all 219.94.117.8 255.255.255.255 trust
hostssl all all 0.0.0.0. 0.0.0.0 trust
host all all 219.94.117.8 255.255.255.255 trust
host all all 0.0.0.0 0.0.0.0 trust
The /var/lib/pgsql/data/postgresql.conf have the following configuration:
# Connection Parameters
#
tcpip_socket = true
#ssl = false
#max_connections = 32
#superuser_reserved_connections = 2
#port = 5432
#hostname_lookup = false
#show_source_port = false
The postgresql start in the /etc/init.d directory with the command ./postgresql start
postgres 16923 0.1 0.3 9556 1956 pts/0 S 01:58 0:00 /usr/bin/postmaster -p 5432 -i
postgres 16925 0.0 0.3 10548 1948 pts/0 S 01:58 0:00 postgres: stats buffer process
postgres 16926 0.0 0.3 9580 1968 pts/0 S 01:58 0:00 postgres: stats collector process
root 16931 0.0 0.1 2664 716 pts/0 R 01:58 0:00 ps aux