我正在尝试将 Hibernate 与 Spring 和 PostgreSQL 一起使用,但我遇到了很多错误,例如:
org.postgresql.Driver : Connection error
ERROR 3424 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
我已将 postgreSQL.Driver 放入我的库中,但没有任何可做的错误提示。
编辑:
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.
最佳答案
检查是否可以使用 telnet 访问您的 PostgreSQL。如果你得到类似的东西:
telnet localhost 5432
Connecting To localhost...
Could not open connection to the host, on port 5432: Connection failed
然后很可能需要根据 this answer on serverfault 将 postgresql.conf
文件中的 listen_addresses
更改为 *
.
关于spring - PostgreSQL hibernate 和 Spring ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49365733/