Enabling Remote Access for PostgreSQL

Allow TCP/IP Connections

You need to edit the PostgreSQL configuration file using any text editor (like Notepad)
C:\Program Files\PostgreSql\data\postgresql.conf or C:\PostgreSql\data\postgresql.conf

Change the following configuration line to match the following if it is not already.
listen_addresses='*'

Enable Clients

Edit the file: pg_hba.conf with any text editor, like Notepad.
C:\PostgreSql\data\pghba.conf or C:\Program Files\PostgreSql\data\pghba.conf

Append the following configuration lines to give access to everyone 0.0.0.0/0 . This can be configured to be ip specific or for a set of ip addresses. Consult the Postgresql documentation for more options.
host all all 10.0.0.0/0 trust

http://www.postgresql.org/docs/8.4/static/runtime-config-connection.html
http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html

Alternative

Both of these settings can be changed using pgAdmin III, which installs with PostgreSQL. Select Tools->Server Configuration->postgresql.conf or pg_hba.conf

Troubleshooting

Unable to connect to the server.
  1. Verify that the port 5432 is not blocked by a firewall. This can occur in one of two ways.
  2. The Windows Firewall is running and does not have an exception for the port. This can be set under Control Panel.
  3. The network on which it is being run blocks the port. Your network administrator will have to open this port or you can change the port to use to a more common port, like 8000.

Last edited Dec 19, 2009 at 4:02 PM by Prolific, version 1

Comments

No comments yet.