Server Error: No pg_hba.conf Entry for Host

In this entry, you will find resolutions for this error when attempting to connect remotely to a PostgreSQL database.

Date Entered: 3/18/2020    Last Updated: 3/18/2020    Author: Garrett Bird

When using one of the PostgreSQL connectors provided by CData, the error below is one of the common errors a user may face when connecting with a remote PostgreSQL database for the first time:

Server error: no pg_hba.conf entry for host "", user "postgres", database "postgres", SSL off Connection was forcibly closed

This error can also occur if the user provides the actual IP address of a local PostgreSQL instance to the Server connection property, rather than "localhost." In any case, the solution can be quickly resolved if the user can access the PostgreSQL instance itself, or can contact an administrator that manages it. The below steps will be all that is needed to enable remote connections to the server from your machine:

  1. In the file explorer, navigate to "data" folder of your PostgreSQL installation. On Windows systems, the full path will generally be C:\Program Files\PostgreSQL\10\data (The numbered folder can vary depending on the PostgreSQL version).
  2. Within this directory will be a file called "pg_hba.conf." Open this file in a text editor of your choice.
  3. Once opened, simply add the below line toward the bottom of the file. In particular, it should be placed in the "IPv4 local connections" group (the IP address specified should be that of the machine you are connecting from): host all all md5
  4. Save and close the file with the change. Then, open the Services window on your machine.
  5. In the list of currently running services, find the service for your PostgreSQL server and restart it. Doing so will apply the changes you made in the conf file to the PostgreSQL server.

Once the above steps are finished, you should now be able to remotely execute queries to your PostgreSQL server from your machine with any of the connectors provided by CData.

We appreciate your feedback.  If you have any questions, comments, or suggestions about this entry, please contact our support team at