I have a Postgres server with Postgis extension enabled running on docker with port 5432 exposed.
Im able to connect using
psql -h localhost -p 5432 -U postgres -d db
but when I try to use the same credentials to add a store using geoserver I get the following error:
Error creating data store, check the parameters. Error message: Unable to obtain connection: Cannot create PoolableConnectionFactory (Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.)
this is my pg_hba.conf file as found on /var/lib/postgresql/data
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
host all all all scram-sha-256
Im using geoserver 2.25
- Tried connecting to postgis instance
psql -h localhost -p 5432 -U postgres -d db - works
2.