org.postgresql.util.PSQLException: The connection attempt failed

The real problem is:

Caused by: java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read

The connection was closed when Java tried to read from it. This can be caused by:

  • The PostgreSQL server being restarted
  • The PostgreSQL backend you were connected to being terminated
  • The PostgreSQL backend you were connected to crashing
  • Dodgy network connection
  • Badly behaved stateful firewalls
  • Idle connections timing out of the NAT connection tables of NAT firewall/routers

… and probably more. Check the PostgreSQL server logs to see if there’s anything informative there; also consider doing some network tracing with a tool like Wireshark.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)