You can connect to PostgreSQL from ArcGIS clients. To do so, be sure PostgreSQL is configured to accept connections from your ArcGIS client machines and create an ArcGIS database connection.
To use your PostgreSQL data in services published to an ArcGIS Server site, register the database or geodatabase with the site.
Connect from ArcMap
PostgreSQL client files are included with ArcGIS Desktop. To connect from ArcMap, configure the database to accept connections, and create a database connection from the Catalog tree in ArcMap or ArcCatalog.
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.
- Alter the PostgreSQL pg_hba.conf file on the database server to accept connections from the ArcGIS client machines.
- Restart PostgreSQL or force the postmaster to reload the pg_hba.conf file by running pg_ctl reload.
- 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
You can connect to a database or geodatabase in PostgreSQL by adding a database connection under the Database Connections node in the Catalog tree in ArcMap or ArcCatalog.
- Expand Database Connections in the Catalog tree in ArcMap or ArcCatalog and double-click Add Database Connection.
- Choose PostgreSQL from the Database Platform drop-down list.
- 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.
- Use Database authentication to connect.
- Provide the name and password of the login role with which you want to connect.
- 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. Also note that Save user name and password must be checked for connection files that provide ArcGIS services with access to the database or geodatabase, or if you want to use the Catalog search to locate data accessed through this connection file.
- Type or choose the name of the database on the PostgreSQL database cluster to which you want to connect.
In the following example, user1 is connecting to database floe on the tundra PostgreSQL database cluster:
- Click OK to connect.
A file is created in \\<computer_name>\Users\<user_name>\AppData\Roaming\ESRI\Desktop<release#>\ArcCatalog.
You can move the connection to another location; just be sure users and applications that need to make a connection have read access to the directory where you place the connection file.
If you use the data from this connection as the source for a service, such as a geoprocessing or geocoding service, you may need to place the connection file in a shared location on your network. See Make your data accessible to ArcGIS Server for more information about sharing a connection file.
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, be sure to alter the PostgreSQL pg_hba.conf file and make sure 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. For geodatabases in PostgreSQL, you have two registration options. See About registering your data with ArcGIS Server for information on registration options and links to topics with instructions for registering your database.