Resolving error: Caused by: org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "11.22.3.44", user "postgres", database "IAM_10_X_0", SSL off

book

Article ID: 213013

calendar_today

Updated On:

Products

Service Virtualization

Issue/Introduction

When connecting DevTest to a remote PostgreSQL database, getting this error:

Caused by: org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "11.22.3.44", user "postgres", database "IAM_10_X_0", SSL off
        at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:514)
        at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:141)
        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:192)
        at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
        at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:195)
        at org.postgresql.Driver.makeConnection(Driver.java:454)
        at org.postgresql.Driver.connect(Driver.java:256)
        at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:321)

Cause

The pg_hba.conf file on the PostgreSQL database does is not configured to accept connections from host.

You configure DevTest property files like you would do for any database, but for PostgreSQL,  you need to add information of all the client hosts connecting to the database.

Environment

DevTest 10.6.0 and later

Service Virtualization

Resolution

Edit file C:\Program Files\PostgreSQL\11\data\pg_hba.conf and add entry of DevTest host machine accessing the database. **

This file controls: which hosts are allowed to connect, how clients are authenticated, which PostgreSQL user names they can use, which databases they can access.  Records take one of these forms:

See example below:

# TYPE  DATABASE        USER            ADDRESS              METHOD

# IPv4 local connections:
host       all                       all                  127.0.0.1/32            md5
host       all                       postgres        55.66.777.8/32        md5         <== this is the IP of the machine PostgreSQL database is running
host       all                       postgres        11.22.3.44/32          md5         <== this is the IP of the machine accessing PostgreSQL

NOTE: If IAM, Enterprise database and Registry are all on separate machines, you will need an entry for each host.

** This would be the location of the pg_hba.conf file for what ever version of PostgreSQL you are running.  This example is PostgreSQL 11.