我正在尝试使用Spring和PostgreSQL的Hibernate,但我有很多错误,如:
org.postgresql.Driver : Connection error
ERROR 3424 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
我把postgreSQL.Driver放在我的libs中,但没有什么可做的错误说那里。
编辑:
2018-03-19 15:54:53.660 INFO 7640 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2018-03-19 15:54:54.664 WARN 7640 --- [ main] unknown.jul.logger : ConnectException occurred while connecting to localhost:5432`
`at com.ttmik.back.MainKt.main(main.kt:19) ~[classes/:na]
2018-03-19 15:54:54.675 ERROR 7640 --- [ main] 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.
答案 0 :(得分:0)
检查是否可以使用telnet访问PostgreSQL。如果你得到类似的东西:
telnet localhost 5432
Connecting To localhost...
Could not open connection to the host, on port 5432: Connection failed
然后很可能需要根据this answer on serverfault将listen_addresses
更改为*
个文件中的postgresql.conf
。