The RELEASE statement places one or more connections in the release-pending state.
This statement can only be embedded within an application program or issued interactively. It is an executable statement that cannot be dynamically prepared. It must not be specified in Java™ or REXX.
RELEASE is not allowed in a trigger. RELEASE is not allowed in an external procedure if the external procedure is called on a remote application server.
None required.
>>-RELEASE--+-server-name--+----------------------------------->< +-variable-----+ +-CURRENT------+ | .-SQL-. | '-ALL--+-----+-'
When the RELEASE statement is executed, the specified server name or the server name contained in the variable must identify an existing connection of the activation group.
An error or warning does not occur if no connections exist when the statement is executed.
If the RELEASE statement is successful, each identified connection is placed in the release-pending state and will therefore be ended during the next commit operation. If the RELEASE statement is unsuccessful, the connection state of the activation group and the states of its connections are unchanged.
RELEASE and CONNECT (Type 1): Using CONNECT (Type 1) semantics does not prevent using RELEASE.
Scope of RELEASE: RELEASE does not close cursors, does not release any resources, and does not prevent further use of the connection.
Resource considerations for remote connections: Resources are required to create and maintain remote connections. Thus, a remote connection that is not going to be reused should be in the release-pending state and one that is going to be reused should not be in the release-pending state.
Connection states: ROLLBACK does not reset the state of a connection from release-pending to held.
If the current connection is in the release-pending state when a commit operation is performed, the connection is ended and the activation group is in the unconnected state. In this case, the next executed SQL statement must be CONNECT or SET CONNECTION.
RELEASE ALL places the connection to the local application server in the release-pending state. A connection in the release-pending state is ended during a commit operation even though it has an open cursor defined with the WITH HOLD clause.
Example 1: The connection to TOROLAB1 is not needed in the next unit of work. The following statement will cause it to be ended during the next commit operation.
EXEC SQL RELEASE TOROLAB1;
Example 2: The current connection is not needed in the next unit of work. The following statement will cause it to be ended during the next commit operation.
EXEC SQL RELEASE CURRENT;
Example 3: None of the existing connections are needed in the next unit of work. The following statement will cause it to be ended during the next commit operation.
EXEC SQL RELEASE ALL;