connect

Description

Creates a connection to Adaptive Server.

Syntax

exec sql connect user_name
[identified by password] [at connection_name]
 [using server_name] [labelname label_name labelvalue label_value …] end-exec

Parameters

user_name

The user name to be used when logging into Adaptive Server.

password

The password to use to log in to Adaptive Server.

connection_name

A name that you choose to uniquely identify the Adaptive Server connection.

server_name

The server name of the Adaptive Server to which you are connecting.

Examples

Example 1

     EXEC SQL BEGIN DECLARE SECTION END-EXEC.
           01         UID             PIC X(32).
           01         PASS            PIC X(32).
           01         SERVER          PIC X(100).
      EXEC SQL END DECLARE SECTION END-EXEC.
 
 
      DISPLAY "UID NAME?".
      ACCEPT UID.
      DISPLAY "PASSWORD ?".
      ACCEPT PASS.
      DISPLAY "SERVER TO CONNECT TO ?".
      ACCEPT SERVER.
 
      EXEC SQL CONNECT :UID IDENTIFIED BY :PASS
                USING :SERVER END-EXEC.

Usage

Table 9-1: How a connection is named

If this clause is used

But without

Then, the ConnectionName is

at connection_name

connection_name

using server_name

at

server_name

None

DEFAULT

See also

at connection_name, exec sql, disconnect, set connection