Search code examples
postgresqlconnectionjhipster

JHipster postgresql connection fail


What causes this connection error in JHipster?

2019-07-15 10:11:55.643 DEBUG 30748 --- [nfoReplicator-0] org.postgresql.Driver                    : Connecting with URL: jdbc:postgresql://localhost:5432/{application_name}
2019-07-15 10:11:55.643 DEBUG 30748 --- [nfoReplicator-0] o.p.core.v3.ConnectionFactoryImpl        : Trying to establish a protocol version 3 connection to localhost:5432
2019-07-15 10:11:55.644 DEBUG 30748 --- [nfoReplicator-0] org.postgresql.Driver                    : Connection error: 

org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:280)

Solution

  • You forgot to start Postgresql, if you haven't installed it on your PC, you can start it using Docker as explained in the doc at https://www.jhipster.tech/docker-compose/#4

    docker-compose -f src/main/docker/postgresql.yml up