"There is no record on pg_hba.conf" error when connecting to Postgres from JBoss ON
Environment
- Postgres 8.x
- Red Hat JBoss Operations Network (ON)
- 2.3
- 2.4
- 3.0
- 3.1
- 3.2
- 3.3
Issue
When we try to connect to a Postgres database we get the following error:
org.postgresql.util.PSQLException: FATAL: there is no record on pg_hba.conf for xxx.xxx.xxx.xxx, user MYUSER, database MYDATABASE, SSL inactive
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:276)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:95)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
at org.postgresql.jdbc2.AbstractJdbc2Connection.(AbstractJdbc2Connection.java:124)
at org.postgresql.jdbc3.AbstractJdbc3Connection.(AbstractJdbc3Connection.java:30)
at org.postgresql.jdbc3.Jdbc3Connection.(Jdbc3Connection.java:24)
...
Resolution
Fix pg_hba.conf to allow access for the JBoss ON server's IP to the database.
- Please check Configuring PostgreSQL for JON for more information.
Root Cause
That error message means that it has connected to the Postgres database on xxx.xxx.xxx.xxx, but the pg_hba.conf file for Postgres does not contain an entry for the user MYUSER and database MYDATABASE.
Diagnostic Steps
Confirm that the user and database names are correct.
Check the pg_hba.conf file to ensure that it is set up correctly.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments