org.postgresql.util.PSQLException:致命:主机没有pg_hba.conf条目 [英] org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host

查看:417
本文介绍了org.postgresql.util.PSQLException:致命:主机没有pg_hba.conf条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Spring JDBC模板连接到位于远程位置的PostgreSQL数据库。我正在

I am trying to connect to PostgreSQL database which is in remote location using Spring JDBC template. I am getting


org.postgresql.util.PSQLException:严重:没有主机139.126.243.71的pg_hba.conf条目,用户来宾,数据库 masterdb,SSL关闭错误

org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "139.126.243.71", user "guest", database "masterdb", SSL off error

我无权访问远程位置的pg_hba.conf文件。

I don't have access to pg_hba.conf file of the remote location.

这是我在春季servlet.xml中给出的配置

This is the configuration I gave in my spring servlet.xml

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="org.postgresql.Driver"/>
    <property name="url" value="jdbc:postgresql://100.64.35.52":5432/masterdb"/>
    <property name="username" value="root"/>
    <property name="password" value="root"/>
</bean>

我们可以通过提供任何属性来解决此问题吗?

Can we solve the issue by giving any properties?

推荐答案

似乎DB服务器不允许SSL关闭连接,您必须启用它。将URL从 jdbc:postgresql://100.64.35.52:5432 / masterdb 更改为 jdbc:postgresql://100.64.35.52:5432 / masterdb?sslmode = require

It seems that DB server does not allow SSL off connection, You will have to enable it. Change URL from jdbc:postgresql://100.64.35.52":5432/masterdb to jdbc:postgresql://100.64.35.52":5432/masterdb?sslmode=require

在< a href = http://www.postgresql.org/docs/9.1/static/libpq-ssl.html> http://www.postgresql.org/docs/9.1/static/libpq-ssl.html

这篇关于org.postgresql.util.PSQLException:致命:主机没有pg_hba.conf条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆