Progress
Programming
Handbook
The CONNECT Statement
The CONNECT statement allows you to connect to a database from a Progress procedure or directly from the Progress Procedure Editor. The CONNECT statement has the following syntax:
physical-name
An argument that represents the actual name of the database on a disk. The first physical–name argument you specify in a CONNECT statement does not require the Database Name (–db) parameter. All subsequent physical–names must be preceded by the –db parameter.
parameter-file
The name of a parameter file that contains database connection information. See the Progress Startup Command and Parameter Reference for more information on parameter files.
parameters
One or more database connection parameters. Each connection parameter applies to the most recently specified database (–db). For the parameters you can specify, see the information on client connection parameters in the Progress Startup Command and Parameter Reference.
NO-ERROR
This argument suppresses the error condition, but still displays the error message when an attempt to CONNECT to a database fails.
Although you can connect to several databases within one CONNECT statement, it is a good idea to connect only one database per CONNECT statement, because a connection failure for one database causes a termination of the current CONNECT statement. However, databases already connected when the statement terminates stay connected. In cases like this, it is a good idea to use the CONNECTED functions to see which databases were connected and which were not.
Here is an example of using a parameter file with the CONNECT statement:
In this example, the CONNECT statement uses the
parm3.pf
file to connect to the appldb1 database.
A single procedure cannot connect to and then access a database. The following code fragment does not run:
By splitting this example into a procedure and a subprocedure, you can connect to the database in the main procedure, and then access it in the subprocedure:
For more information on the CONNECT statement, see the Progress Language Reference .
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |