Ending connections
Because remote SQL connections use resources, end the connections that are no longer used, as soon as possible. You can end connections implicitly or explicitly.
Connections can be explicitly ended by either the DISCONNECT statement or the RELEASE statement followed by a successful COMMIT. The DISCONNECT statement can only be used with connections that use unprotected connections or with local connections. The DISCONNECT statement will end the connection when the statement is run. The RELEASE statement can be used with either protected or unprotected connections. When the RELEASE statement is run, the connection is not ended but instead placed into the released state. A connection that is in the release stated can still be used. The connection is not ended until a successful COMMIT is run. A ROLLBACK or an unsuccessful COMMIT will not end a connection in the released state.
When a remote SQL connection is established, a distributed data management (DDM) network connection (Advanced Program-to-Program Communication (APPC) conversation or TCP/IP connection) is used. When the SQL connection is ended, the network connection might either be placed in the unused state or dropped. Whether a network connection is dropped or placed in the unused state depends on the DDMCNV job attribute. If the job attribute value is *KEEP and the connection is to a server on the System i™ platform, the connection becomes unused. If the job attribute value is *DROP and the connection is to a server on the System i platform, the connection is dropped. If the connection is to a server on a non-System i platform, the connection is always dropped. *DROP is desirable in the following situations:
- When the cost of maintaining the unused connection is high and the connection will not be used relatively soon.
- When running with a mixture of programs, some compiled with RUW connection management and some programs compiled with DUW connection management. Attempts to run programs compiled with RUW connection management to remote locations will fail when protected connections exist.
- When running with protected connections using either DDM or DRDA®. Additional overhead is incurred on commits and rollbacks for unused protected connections.
The Reclaim DDM connections (RCLDDMCNV) command may be used to end all unused connections, if they are at a commit boundary.
Parent topic:
Distributed support
Related reference
Implicit connection management for the default activation group
Implicit connection management for nondefault activation groups