Thread: JDBC conncetion fails, please, advise
Hi,
Please can you assist.
I am trying to connect to PostgreSQL via JDBC.
Database version is 8.0.1 and java software version 1.4.2.
I have configured the pg_hba.conf file as follows
host all all ip_address/32 trust
ip_address is the ip_address of the host holding the database.
my connection string to postgres is as
'jdbc:postgresql://my_host:5432/my_database'
I'm getting the error message:
Connection error has occurred: org.postgresql.util.PSQLException: FATAL: missing or erroneous pg_hba.conf file
what is the problem? Please, advise.
Regards,
Leena
Is your client machine on the same machine as the database? Your pg_hba.conf file needs to have an entry in it that covers your client machine. It's not 100% clear from your post whether you've achieved that or not (I think you've added your server to the pg_hba.conf, not your client). So if my server is on 192.168.2.1 and my client is 10.10.10.1 then the pg_hba.conf file needs: # TYPE DATABASE USER CIDR-ADDRESS METHOD # IPv4 non-local connections: host all all 10.10.10.1/32 trust And the jdbc connect string will be something like jdbc:postgresql://192.168.2.1/my_database Can you post your pg_hba.conf file? Cheers, Robin Leena Puijola wrote: >Hi, > >Please can you assist. > >I am trying to connect to PostgreSQL via JDBC. > >Database version is 8.0.1 and java software version 1.4.2. > > >I have configured the pg_hba.conf file as follows > >host all all ip_address/32 trust > > >ip_address is the ip_address of the host holding the database. > > >my connection string to postgres is as >'jdbc:postgresql://my_host:5432/my_database' > > >I'm getting the error message: > >Connection error has occurred: org.postgresql.util.PSQLException: FATAL: missing or erroneous pg_hba.conf file > > > >what is the problem? Please, advise. > >Regards, >Leena > > >