Connecting to a database

The first step in creating a query layer in ArcGIS is to make a connection to the database you want to query.

Steps:
  1. In ArcMap, click File > Add Data > Add Query Layer.

    This opens the New Query Layer dialog box.

  2. A connection to the database must be established before building queries in the New Query Layer dialog box. If you have previously made a connection in the dialog box, you can choose it from the Connection menu. Otherwise, create a new connection by clicking Connections. This opens the Manage Connection(s) dialog box from which you can create new connections as well as edit or delete existing connections.
  3. Click New to create a new connection.

    The Database Connection dialog box opens.

  4. From the DBMS Client menu, choose the type of database to which you want to connect.
    NoteNote:

    For Oracle, choose the release of the Oracle client you are using to make the connection rather than the release of the database.

  5. In the Data Source text box, type one of the following based on which database you are using:
    • IBM DB2 or DB2 for z/OS—Type the name of the database alias.
    • Informix—Type the data source name.
    • Oracle—Type the Oracle Net service name.
    • PostgreSQL—Type the name of the server where PostgreSQL is installed.
    • Microsoft SQL Server—Type the name of the SQL Server instance.
  6. If you are connecting to a PostgreSQL or SQL Server database, type the name of the database in the Database text box.
  7. Specify how you want your connection to be authenticated in the database by choosing one of the following from the Authentication menu:
    • Choose OS authentication if you want the database to use your Windows login to authenticate your connection, and proceed to step 11.
    • Choose Database Authentication if you want to use a database user to connect.
  8. If you chose Database Authentication, type the name of the database user in the Username text box.
  9. Type the password for the database user in the Password text box.
  10. If you do not want to store the database user name and password with the query layer, uncheck Save username and password. Otherwise, leave it checked.
    TipTip:

    You might uncheck Save username and password if you are going to share the query layer connection with other users.

  11. Click Test Connection to be sure you can connect to the database.

    If the connection fails, double-check the information you provided. If it is correct but the connection still fails, make sure the database is accepting connections.

  12. Click OK to create the database connection.
  13. If you do not want to use the default name, Connection to <DBMS>, type a new name.
    NoteNote:

    The name of the connection cannot be changed later. To change the name of a connection, you must delete it and re-create it.


8/2/2012