4
votes

I'm trying to set up a JDBC connection to postgres from another program.

When I run the program, I get the following error:

[2013-03-24 03:14:10,542][ERROR][org.elasticsearch.river.jdbc.strategy.simple.SimpleRiverSource] while opening read connection: jdbc:postgresql://[my postgres server's ip address]:5432/[my database name] FATAL: no pg_hba.conf entry for host "[my client ip address]", user "postgres", database "[my database name]", SSL off

I can connect to the server successfully with a command line client by running: psql -d [my database name] -U postgres -p 5432 -h [my postgres server ip address]

I think then that I have a unix socket connection that works but need to enable tcp connection in the pg_hba.conf, but it looks like I already have several tcp connections allowed in the pg_hba.conf file below... can anyone advise what I may be doing wrong?

My pg_hba.conf contains the following uncommented lines:

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
1

1 Answers

2
votes

If doing devel on local computer and booth program and DB run on the same machine go with:

# IPv4 local connections:
host    all             all             127.0.0.1/32            trust