用于 jdbc 的 postgres hba.conf
问题:用于 jdbc 的 postgres hba.conf 我正在尝试从另一个程序建立与 postgres 的 JDBC 连接。 当我运行程序时,我收到以下错误: [2013-03-24 03:14:10,542][ERROR][org.elasticsearch.river.jdbc.strategy.simple.SimpleRiverSource] 同时打开读取连接:jdbc:postgr
问题:用于 jdbc 的 postgres hba.conf
我正在尝试从另一个程序建立与 postgres 的 JDBC 连接。
当我运行程序时,我收到以下错误:
[2013-03-24 03:14:10,542][ERROR][org.elasticsearch.river.jdbc.strategy.simple.SimpleRiverSource] 同时打开读取连接:jdbc:postgresql://[my postgres 服务器的 ip address]:5432/[my database name] FATAL: no pg_hba.conf entry for host "[my client ip address]", user "postgres", database "[my数据库名称]",SSL 关闭
我可以通过运行命令行客户端成功连接到服务器: psql -d [my database name] -U postgres -p 5432 -h [my postgres server ip address]
我认为我有一个可以工作的 unix 套接字连接,但需要在 pg_hba.conf 中启用 tcp 连接,但看起来我已经在下面的 pg_hba.conf 文件中允许了多个 tcp 连接......可以任何人都建议我可能做错了什么?
我的 pg_hba.conf 包含以下未注释的行:
hostssl all all 0.0.0.0/0 md5
host all all 10.0.0.0/8 md5
local all postgres peer
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
解答
如果在本地计算机上进行开发,并且booth程序和数据库在同一台机器上运行,请使用:
# IPv4 local connections:
host all all 127.0.0.1/32 trust
更多推荐
所有评论(0)