Implicit connection management for nondefault activation groups

The application requester can implicitly connect to an application server.

Implicit connection occurs when the application requester detects the first SQL statement issued for the activation group and it is not a CONNECT statement with parameters.

For a distributed program, the implicit connection is made to the relational database specified on the RDB parameter. For a nondistributed program, the implicit connection is made to the local relational database.

Implicit disconnection can occur at the following parts of a process:

The following example program is not distributed (no connection is required). It is a program run at a Spiffy Corporation regional office to gather local repair information into a report.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.
CRTSQLxxx PGM(SPIFFY/FIXTOTAL) COMMIT(*CHG) RDB(*NONE)
 
    PROC: FIXTOTAL;
       .
       .
       .
      SELECT * INTO :SERVICE      A
               FROM REPAIRTOT;
    EXEC SQL
    COMMIT;
       .
       .
       .
    END FIXTOTAL;
A
Statement run on the local relational database

Another program, such as the following example, can gather the same information from Spiffy dealerships in the Kansas City region. This is an example of a distributed program that is implicitly connected and disconnected:

CRTSQLxxx PGM(SPIFFY/FIXES) COMMIT(*CHG) RDB(KC101) RDBCNNMTH(*RUW)
 
    PROC: FIXES;
       .
       .
       .
    EXEC SQL
      SELECT * INTO :SERVICE              B
               FROM SPIFFY.REPAIR1;
 
    EXEC SQL  C
     COMMIT;
       .
       .
       .
    END FIXES;  D
B
Implicit connection to application server (AS). The statement runs on the AS.
C
End of unit of work. The application requester (AR) is placed in a connectable and connected state if the COMMIT is successful.
D
Implicit disconnection at the end of the SQL program.