Progress
Client Deployment
Guide


Connection Techniques

There are five ways to connect a database:

NOTE: Starting a server or broker for a database is distinct from connecting to a database. You must start a server or broker for a database before you can connect to the database in multi-user mode. For information about starting a server or broker, see the Progress Installation and Configuration Guide Version 9 for Windows or the Progress Installation and Configuration Guide Version 9 for UNIX.

This section explains how to connect to databases using the various techniques. The Progress Programming Handbook explains why you might choose one technique instead of another.

Connecting at Startup

You can connect to databases at session startup with one of the Progress startup commands or with an application startup file. For example, the following PRO command starts a single-user session and connects to three databases:

pro -db mydb1 -db mydb2 -db mydb3 

NOTE: To retain compatibility with earlier versions, Progress does not require you to specify the Database Name (-db) connection parameter for the first database on the command line.

If you specify more than one database when you start a session, it is important to specify the connection parameters for each database directly after the database name to which they apply, and before the next Database Name (-db) connection parameter. Progress applies database connection parameters only to the previously specified database.

The following syntax example illustrates the correct location for database connection parameters:

mpro [ -db ] db1-name [ db1-parameters ]
    [ -db db2-name [ db2-parameters ] ] ... 

You can specify all other parameters anywhere on the command line. If you specify the same parameter more than once, Progress uses the value you specified for the last instance of the parameter.

You can also use a parameter file to specify database connection parameters. The following example shows a UNIX startup script for a Progress application. The last line invokes the _progres executable:

DLC=${DLC-/usr/dlc}; export DLC
PATH=:$PATH:$DLC; export PATH
PROPATH=:$DLC; export PROPATH
exec $DLC/_progres -pf parm1.pf -pf parm2.pf -p $APPL/start.p 

The previous startup script sets up environment variables for a Progress application and starts a Progress application session using two parameter files called parm1.pf and parm2.pf. The parm1.pf parameter file contains the following entry:

-db appldb1 -1 bi-file1 

The parm2.pf parameter file contains the following entry:

-db appldb2 -1 bi-file2 

This example illustrates a common approach to connecting multiple databases when you start Progress using a parameter file for each database. Each parameter file is specified on the command line with the Parameter File (-pf) startup parameter.

Connecting from a Procedure with the CONNECT Statement

The CONNECT statement allows you to connect to a database from a Progress procedure or from the Progress Procedure Editor.

The following CONNECT statements connect the appldb1 database in single-user mode, the appldb2 database in multi-user mode, and the databases specified in the parameter file, parm3.pf (respectively):

CONNECT appldb1 -1.
CONNECT appldb2.
CONNECT -pf parm3.pf. 

Connecting with the CONNECT statement is very similar to connecting at startup. Although it is possible to connect to several databases within one CONNECT statement, it is a good idea to connect only one database per CONNECT statement. A connection failure for one database causes a termination of the current CONNECT statement, leaving any subsequent database specified with the CONNECT statement unconnected. For detailed information about the CONNECT statement, see the Progress Language Reference and the Progress Programming Handbook.

Connecting with the Data Dictionary

You can connect to a database during a Progress session using the Data Dictionary.

Follow these steps to connect to a database with the Data Dictionary using a graphical user interface:

  1. Access the Data Dictionary. The Data Dictionary main window appears:
  2. Choose Database Connect. The Connect Database dialog box appears:
  3. Choose the Options button. The Connect Database dialog box expands to show optional connection controls:
  4. Enter the following information, then choose OK:
    • Physical Name — Specifies the actual name of the database on a disk.
    • Logical Name — Specifies the database name that references a connected physical database.
    • Database Type — Specifies the database type. The only possible value is Progress.
    • Network — Specifies the network type, if you are connecting to a network server. The only possible values are TCP or SNA (for Progress/400).
    • Multiple Users — Specifies whether you want multiple users to be able to access this database simultaneously.
    • Host Name — Specifies the database server machine in a network environment.
    • Service Name — Specifies the broker or server service name in a network environment.
    • User Id — Identifies your user ID.
    • Password — Identifies your password.
    • Trigger Location — Identifies a directory or Progress library where trigger code is stored.
    • Parameter File — Specifies the parameter filename that contains the startup parameters for the database.
    • Other CONNECT Statement Parameters — Specifies any other startup parameters for the database that are not included in the parameter file.
    • Progress returns you to the Data Dictionary main window. The Data Dictionary constructs (and executes) a CONNECT statement using the information you supply. Therefore, any rules that apply to the CONNECT statement also apply to database connections using the Data Dictionary.

Connecting with the Data Administration Tool

Follow these steps to connect to a database with the Data Administration tool using a graphical interface:

  1. Access the Data Administration tool. The Data Administration main window appears:
  2. Choose Database Connect. The Connect Database dialog box appears:
  3. Choose the Options button. The Connect Database dialog box expands to show optional connection controls:
  4. Enter the following information, then choose OK:
    • Physical Name — Specifies the actual name of the database on a disk.
    • Logical Name — Specifies the database name that references a connected physical database.
    • Database Type — Specifies the database type. The only possible value is Progress.
    • Network — Specifies the network type, if you are connecting to a network server. The only possible values are TCP or SNA (for Progress/400).
    • Multiple Users — Specifies whether you want multiple users to be able to access this database simultaneously.
    • Host Name — Specifies the database server machine in a network environment.
    • Service Name — Specifies the broker or server service name in a network environment.
    • User Id — Identifies your user ID.
    • Password — Identifies your password.
    • Trigger Location — Identifies a directory or Progress library where trigger code is stored.
    • Parameter File — Specifies the parameter filename that contains the startup parameters for the database.
    • Other CONNECT Statement Parameters — Specifies any other startup parameters for the database that are not included in the parameter file.
    • Progress returns you to the Data Administration main window. The Data Administration tool constructs (and executes) a CONNECT statement using the information you supply. Therefore, any rules that apply to the CONNECT statement also apply to database connections using the Data Administration tool.

Connecting with Auto-connect

The Progress auto-connect feature allows you to connect to databases automatically as required during program execution. To perform an auto-connect operation, Progress uses information stored in a primary database to connect to a secondary application database, before running compiled procedures that access the second database. The primary database (the one that contains the auto-connect information for one or more additional databases) must be connected before Progress can perform an auto-connect.

Use the Data Administration tool to build an auto-connect list for a primary database. Follow these steps to create or edit an auto-connect list:

  1. Access the Data Administration tool.
  2. Choose Utilities Edit Progress Auto-Connect List. The Edit Auto-Connect List dialog box appears:
  3. Enter or edit connection information for a database.

If you connect to a database with the CONNECT statement, and that database also has an auto-connect entry in an already connected database, the connection information from both the CONNECT statement and the auto-connect list is merged. In this situation, the connection information in the CONNECT statement takes precedence. For more information about the CONNECT statement, see the Progress Language Reference.

If the primary database is a schema holder for a DataServer schema, the DataServer schema is automatically included in the auto-connect list, but it does not appear on the auto-connect list as viewed from the Data Dictionary.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095