I hava a PostgreSQL database on my PC. The Postgres server is running on port 5432. When I go on another PC and type in telnet server.ip 5432, I manage to connect. However when I try to connect using Java:
connection = DriverManager.getConnection("Jdbc:postgresql:mydb://server.ip:5432/", "user", "pass");
I get the following error: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. Can someone tell me what the problem might be?
UPDATE:
I changed the connection string to:
connection = DriverManager.getConnection("jdbc:postgresql://server.ip:5432/mydb", "user", "pass");
and now I am getting the error FATAL: no pg_hba.conf entry for host "client.ip", user "user", database "mydb", SSL off