In most application programs you embed the CONNECT command to
start a DBE session in a program:
EXEC SQL CONNECT TO DBEnvironmentName
|
If autostart mode is ON at runtime, this command starts a DBE
session. If autostart mode is OFF, a DBA must issue a START DBE
command before the program can be executed. Regardless of the
autostart mode in effect, the program user must have CONNECT and
RUN authority for this command to execute.
You can embed the START DBE command in a program to start a DBE
session if the owner of the program has DBA authority. However,
only one copy of the program can be executed at a time, by a
user with DBA authority. For single-user DBEnvironments, this
constraint poses no problem. In a multiuser environment,
however, once a DBEnvironment is started, only the CONNECT
command can be used to initiate additional DBE sessions.
Place the DBE session initiation command in a subprogram unit of
your program such that it executes at runtime before all other
SQL commands in your program except a WHENEVER command which
may be executed before a CONNECT TO command is executed.
If the program uses either a dynamic command or a host variable
to connect to a DBEnvironment, the command or variable must have
been entered by the program user prior to attempting to execute
any other embedded SQL command.