DB2 Version 10.1 for Linux, UNIX, and Windows

MON_GET_APPLICATION_HANDLE scalar function - Get connection application handle

The MON_GET_APPLICATION_HANDLE scalar function returns the application handle of the invoking application. The data type of the result is BIGINT.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-MON_GET_APPLICATION_HANDLE--(--)----------------------------><

The schema is SYSPROC.

Authorization

One of the following authorizations is required:
  • EXECUTE privilege on the function
  • DATAACCESS authority
  • DBADM authority
  • SQLADM authority

Default PUBLIC privilege

In a non-restrictive database, EXECUTE privilege is granted to PUBLIC when the function is automatically created.

Example

The MON_GET_APPLICATION_HANDLE scalar function can be used to pass in the application handle of the current session into monitoring functions which filter based on the application handle, such that the session can access its own monitoring information. For example:

select application_handle, application_name, application_id, member, rows_read
from table(sysproc.mon_get_connection(sysproc.mon_get_application_handle(), -1))
as conn

The following is an example of output from this query.

APPLICATION_HANDLE   APPLICATION_NAME  APPLICATION_ID                  MEMBER 
-------------------- ----------------- ------------------------------- -------
                 644             db2bp    *LOCAL.amurchis.110831180720       0
                 
 ROWS_READ 
 ----------
          0


  1 record(s) selected.