Configuring a PostgreSQL database cluster on Windows to accept connections

After you install PostgreSQL, you must configure the database cluster to accept client connections.

PostgreSQL uses a configuration file, pg_hba.conf, to store connection information.

NoteNote:

You may have to add the IP address of the local computer before you can start an ArcSDE service.

You can either alter the pg_hba.conf file directly by opening it in a text editor, such as Notepad, or you can alter the pg_hba.conf file through PgAdminIII.

Steps:
  1. Make a backup copy of the pg_hba.conf file before you alter it.
  2. Open the pg_hba.conf file by doing one of the following:
    • Start PgAdminIII, connect to the PostgreSQL instance as the postgres super user, connect to the database, Click Tools, point to Server Configuration, then click pg_hba.conf.
    • Start Notepad or another text editor application and open the pg_hba.conf file from the PostgreSQL installation directory.
  3. Add the IP addresses of connecting client machines and the client authentication methods used for connections.

    For example, to allow any user who supplies a valid password to connect to a database named habitat from addresses beginning with 10.2.12 using an md5 connection, add the following line to the pg_hba.conf file:

    host habitat all 10.2.12.0/24 md5
    

    If you want to allow all users who supply a valid password to connect to any of the databases on the PostgreSQL instance from addresses beginning with 100, you would add a line similar to the following to the pg_hba.conf file:

    host all all 100.0.0.0/8 md5
    

    The preceding examples were for IPV4 addresses. If you need to configure the database cluster to accept connections from machines with an IPV6 address, the format would be as follows:

    host all all fe60::61f9:1253:c522:9b92%10/128 md5
    

    To allow any machines with an address beginning with fe60 to connect, you would add this line to the pg_hba.conf file:

    host all all fe60::0000:0000:0000:0000%10/8 md5

    If your PostgreSQL database cluster is set up on a machine that has an IPV6 address and you want machines with an IPV4 address to connect to it, you need to uncomment the following line in the pg_hba.conf file:

    host all all ::1/128 md5
    

8/21/2013