I'm trying to connect to my PostgreSQL database on a VPS from my Windows machine using DBeaver, but I'm running into some trouble. The SSH Tunnel connection works perfectly in DBeaver, and I can connect successfully. However, when I attempt to connect to the actual database and test the connection, I receive an EOFException that says the connection attempt failed. I've checked the connection limits in the PostgreSQL configuration file, which is set to 100, and I've confirmed my credentials are accurate. I can even access the database without issues when SSHing into the server and using the psql command from the command line. What would be the next step to debug this issue?
4 Answers
First, make sure that the IP you're trying to connect from is permitted in the `pg_hba.conf`. Also, check if PostgreSQL is set to listen on all interfaces or just localhost. If you're tunneling into the server, the host address in DBeaver should be set to 'localhost'.
You might want to check for any issues between IPv4 and IPv6. Localhost could be mapped to ::1 on newer systems, which might cause a mismatch in your `pg_hba.conf`. Additionally, SSL settings might be causing issues too. Have you seen any more detailed stack traces besides the EOFException?
When you say you're connecting to the DB, can you clarify if that means using the SSH tunnel or directly using the IP address? Make sure to check the `listen_addresses` setting in your config file as well. Also, remember to check if there’s a firewall like UFW on your VPS; the port needs to be open and not using the default.
Another option is to install PostgreSQL on your local network just for testing. It’s quick and won’t require you to set up a new database. I suspect the issue might lie within the VPS setup. Also, double-check that you’re using the correct port; try 5431 instead of the usual 5432.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures