Connect to PostgreSQL from ArcGIS

The following list summarizes the steps required to connect from ArcGIS to a PostgreSQL database, including a database that contains an enterprise geodatabase:

PostgreSQL client files are installed with ArcGIS Pro and ArcGIS Server; you do not need to install a PostgreSQL client or set environment variables to access the client.

Connect to the database

You can use the Database Connection dialog box in ArcGIS Pro to connect to the database, as described below.

Alternatively, you can run the Create Database Connection tool in ArcGIS Pro or use Python to run the Create Database Connection command from an ArcGIS Server machine to create a database connection file (.sde) that connects to the database.

To use the database connection file with ArcGIS Server, you must save the user information with the connection file.

Tip:

Ensure the account used for the connection has the appropriate privileges in the database and on the data that the account needs to access. See Privileges for geodatabases in PostgreSQL and Privileges for using ArcGIS with a PostgreSQL database for more information.

Follow these steps to connect to a PostgreSQL database from the Database Connection dialog box in ArcGIS Pro:

  1. Open the Catalog pane in ArcGIS Pro.
  2. Right-click Databases and click New Database Connection.
  3. Choose PostgreSQL from the Database Platform drop-down list.
  4. In the Instance 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 Instance 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 Instance text box.

    For more examples, including examples of connecting to PostgreSQL database services, see Database connections in ArcGIS Pro.

    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 Instance text box.

  5. Choose Database authentication for the Authentication Type.
  6. Provide a valid database username and password in the User name and Password text boxes, respectively.
  7. 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 username 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.

  8. Type or choose the name of the database on the PostgreSQL database cluster to which you want to connect.
  9. Click OK to create the connection file.

A database connection appears under Databases in the Catalog pane, and a connection file (.sde) is created in the ArcGIS Pro project directory.

You can rename the file by typing a new name in the Catalog pane and pressing Enter.

Register the connection with ArcGIS Server

To allow the ArcGIS Server site to access the data, use the database connection file you created to add a registered data store in ArcGIS Pro or add a data store item in the portal.