Cannot Connect to Local Postgres from DataGrip/IntelliJ?

Thought I was going mad - I’m running local Postgres from WSL using Podman and definitely exposing port 5432 but IntelliJ (DataGrip) won’t connect:

The error is:

Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

To confirm the port is exposed to the master host I can sysinternals TCPView:

image-20220527113524943

Indeed 5432 is listening to connections, but not on localhost - it’s using IPv6 only. In IPv6 terms localhost is called ::1 so changing to that works fine:

image-20220527113654031


To contact me, send an email anytime or leave a comment below.