CONNECT command

The CONNECT command stablishes a connection to a database data source.

Subsequent procedure commands will run at the specified data source. The running procedure's server will also be changed to the specified server. No immediate action is taken upon any other current objects within the procedure. However, subsequent commands which affect those objects might result in additional processing.

For example, assume query Q1 has been run but not completed at server X. The CONNECT TO 'SERVER Y' command is then issued, connecting to server Y. Next, the SAVE DATA AS T1 command is issued.

Query Q1 is not immediately affected by the CONNECT command to server Y, but the SAVE DATA command requires completion (or cancellation) of query Q1 at server X. Once the data object is completed, the server for query Q1 is changed to Y, and the data is saved in table T1 at server Y.

Syntax

>>-- CONNECT --------------- TO ServerName ------------------------<<
             +- UserName -+              (PASSWORD=password 
Parameter Description
ServerName The name of a database server. If the name includes spaces, enclose it in quotes.
UserName The user name that will be used to connect to the database server. UserName is an optional parameter.
PASSWORD The password that will be used to connect to the database server. If you specify UserName, you must supply a password using the PASSWORD parameter.

Example

CONNECT TO SERVER1
CONNECT pjones TO SERVER1 (PASSWORD=sales