CURRENT CLIENT_APPLNAME
CURRENT CLIENT_APPLNAME contains the value of the application name from the client information that is specified for the connection.
The data type is VARCHAR(255).
The default application name varies, depending on the connection:
- If the connection is from a remote application client driver, the default is the application name as supplied by the driver. Default values set by the IBM® Data Server Driver for JDBC and SQLJ can be obtained from the DatabaseMetaData.getClientInfoProperties method.
- If the connection is from a remote DB2® 10 for z/OS® application,
the default varies depending on which attachment facility is used:
- TSO attachment facility
- The default application name is one of the following cases:
- The TSO logon user ID when the application runs in TSO foreground using TSO online applications like SPUFI.
- The job name when the application runs in TSO background using TSO batch applications like DSNTEP2.
- RRS attachment facility interface
- The correlation ID that is provided at the call of the RRS DSNRLI SIGNON function.
- Call attachment facility
- The job name.
- CICS® attachment facility
- The first 8 bytes of the correlation ID. In particular the correlation ID is a 12-byte string for a CICS transaction, where the first 8 bytes are used as the default application name.
- IMS™ Attachment facility
- An 8-byte string, the Program Specification Block (PSB) name, or the program name.
The value of the special register can be changed by using one of the following application programming interfaces (APIs):
- SQLE_CLIENT_INFO_APPLNAME (sqleseti)
- DB2Connection.setDB2ClientApplicationInformation(String info)
- The RRS DSNRLI SIGNON, AUTH SIGNON, CONTEXT SIGNON, or SET_CLIENT_ID function
- The WLM_SET_CLIENT_INFO stored procedure
When the client application name is explicitly set, it overwrites the default application name described above and is used as the client application name.
In a distributed environment, if the value set by the API exceeds 32 bytes, it is truncated to 32 bytes.
If one of these APIs is not used to set the value of the special register, an empty string is returned when the special register is referenced.
Example:
Select the departments that are allowed to use the application that
is being used in this connection.
SELECT DEPT
FROM DEPT_APPL_MAP
WHERE APPL_NAME = CURRENT CLIENT_APPLNAME