【发布时间】:2022-02-21 14:23:14
【问题描述】:
我创建了 spring 项目来对 postgres 数据库服务器进行 CRUD,但出现了一些错误。
HHH000342:无法获得查询元数据的连接
org.postgresql.util.PSQLException:连接尝试失败。 在 org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:313) ~[postgresql-42.3.1.jar:42.3.1] 在 org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51) ~[postgresql-42.3.1.jar:42.3.1] 在 org.postgresql.jdbc.PgConnection.(PgConnection.java:225) ~[postgresql-42.3.1.jar:42.3.1] 在 org.postgresql.Driver.makeConnection(Driver.java:466) ~[postgresql-42.3.1.jar:42.3.1] 在 org.postgresql.Driver.connect(Driver.java:265) ~[postgresql-42.3.1.jar:42.3.1] 在 com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-4.0.3.jar:na]
这是我的 application.properties
spring.datasource.url=jdbc:postgresql://3.1.84.18:5432/postgres
spring.datasource.username=postgres
spring.datasource.password=postgres
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=none spring.jpa.show-sql=true
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
我的 pom.xml
【问题讨论】:
-
谢谢,在文件 pg_hba.config 中我们更新了“host all all 0.0.0.0/0 md5”。我从 ident 改成了 md5 认证方式,成功了!
-
请不将 (XML) 代码发布为图像。请参阅此处了解更多详细信息原因:meta.stackoverflow.com/questions/285551
标签: postgresql jpa