Connect to PostgreSQL from ArcGIS

To connect to PostgreSQL from ArcGIS clients, be sure PostgreSQL is configured to accept connections from your ArcGIS client machines and that the database name can be used by ArcGIS, and then you can create an ArcGIS database connection.

To publish ArcGIS Server web services that reference the data in your PostgreSQL database, register the database connection file with your ArcGIS Server sites.

Connect from ArcGIS Pro

PostgreSQL client files are installed with ArcGIS Pro. To connect to a PostgreSQL database from an ArcGIS Pro project, configure the database to accept connections and create a database connection.

Configure the database to allow connections

Alter the PostgreSQL pg_hba.conf file and make sure the necessary login or group roles have CONNECT privileges in the database.

  1. Alter the PostgreSQL pg_hba.conf file on the database server to accept connections from the ArcGIS client machines.
  2. Restart PostgreSQL or force the postmaster to reload the pg_hba.conf file by running pg_ctl reload.
  3. Be sure users have privileges to connect to the database cluster.

    By default, Public has CONNECT privileges to the PostgreSQL database cluster; therefore, you only need to grant CONNECT to individual login or group roles if you revoked the CONNECT privilege from Public.

Connect to the database

Add a database connection using the Database Connection dialog box or the Create Database Connection tool. The following steps describe using the Database Connection dialog box.

  1. Right-click Databases in the Catalog pane and click New Database Connection.
  2. Choose PostgreSQL from the Database Platform drop-down list.
  3. In the Data source text box, type the database cluster name or IP address of the server where PostgreSQL is installed.

    For example, if your PostgreSQL database cluster is named ficus, type ficus in the Data source text box. If specifying an IPV6 address, enclose the address in brackets. For example, if the IPV6 address of the server is 1111:aa1:0:1:f111:a222:33f3:b4bb, type [1111:aa1:0:1:f111:a222:33f3:b4bb] in the Data source text box.

    Note:

    If your PostgreSQL database cluster is listening on a port other than the default (5432), include the port number in the instance. For example, if PostgreSQL is installed on server mamabear and is listening on port 49200, type mamabear,49200 in the Data source text box.

  4. Choose Database authentication for the Authentication Type.
  5. Provide a valid database user name and password in the User name and Password text boxes, respectively.
  6. Uncheck Save user name and password if you prefer not to save your login information as part of the connection; doing this can help maintain the security of the database. However, if you do this, you will be prompted to provide a user name and password every time you connect.

    Note:

    Save user name and password must be checked for connection files that provide ArcGIS web services with access to the database, or if you want to search ArcGIS Pro to locate data accessed through this connection file.

  7. Type or choose the name of the database on the PostgreSQL database cluster to which you want to connect.
  8. Click OK to connect.

Connect from ArcGIS Server

ArcGIS Server includes PostgreSQL client files; therefore, you do not need to download and copy PostgreSQL client files to connect.

As with connections from other clients, alter the PostgreSQL pg_hba.conf file to allow ArcGIS machines to connect to the database, and enure the necessary login or group roles have CONNECT privileges in the database.

If you want the services you publish to ArcGIS Server to use the data in your database or a geodatabase in PostgreSQL, register the database with your ArcGIS Server sites. See Manage registered data stores for instructions.