CURRENT CLIENT_USERID special register

CURRENT CLIENT_USERID contains the value of the client user ID from the client information that is specified for the connection.

The default client user ID is the primary authorization ID used to establish the connection.

The data type is VARCHAR(255).

The value of the special register can be changed by using one of the following application programming interfaces (APIs):

  • SQLE_CLIENT_INFO_USERID (sqleseti)
  • SQLSetConnectAttr (ODBC)
  • java.sql.Connection.setClientInfo (JDBC)
  • The RRS DSNRLI SIGNON, AUTH SIGNON, CONTEXT SIGNON, or SET_CLIENT_ID function
  • The WLM_SET_CLIENT_INFO stored procedure

When the client user ID is explicitly set, it overwrites the primary authorization id described above and is used as the client user ID.

If the value set by the API exceeds 128 bytes, it is truncated to 128 bytes.

The application compatibility value of the package determines the length and blank padding of the CURRENT CLIENT_USERID special register returned.

Start of change

Monitoring remote user statistics based on CURRENT CLIENT_USERID (IFCID 412)

You can start a trace that includes statistics class 11 (IFCID 412) to monitor statistics for remote DRDA users based on the CURRENT CLIENT_USERID special register. For more information, see Statistics trace.

Important: Start of changeMonitoring of applications with IFCID 412 is limited to 6000 unique user ID values. If this limit is exceeded, Db2 issues DSNL030I with reason code 00D3105E and stops collecting the statistics for any new user IDs until DDF is restarted. For best results, use the CLIENT_CORR_TOKEN special register to identify individual connections.End of change
End of change

Example

Find out in which department the current client user ID works.
  SELECT DEPT
    FROM DEPT_USERID_MAP
    WHERE USER_ID = CURRENT CLIENT_USERID