3 Advanced Features : Using Client Information

Using Client Information
Many databases allow applications to store client information associated with a connection. For example, the following types of information can be useful for database administration and monitoring purposes:
User ID for whom the application using the connection is performing work. The user ID may be different than the user ID that was used to establish the connection.
Client information is available in the following DataDirect Connect Series for ODBC drivers:
For DB2 V9.5 and V9.7 for Linux/UNIX/Windows and DB2 for z/OS, this information can feed directly into the Workload Manager (WLM) for workload management and monitoring purposes.
For Oracle 11g R2, this information is managed through the client information feature.
See “Storing Client Information” for more information about how DB2 and Oracle store client information.
How Databases Store Client Information
Typically, databases that support storing client information do so by providing a register, a variable, or a column in a system table in which the information is stored. If an application attempts to store information and the database does not provide a mechanism for storing that information, the driver caches the information locally. Similarly, if an application returns client information and the database does not provide a mechanism for storing that information, the driver returns the locally cached value.
Storing Client Information
Your application can store client information associated with a connection. Table 3-2 shows the driver connection options that your application can use to store client information and where that client information is stored for each database. See the specific driver chapters for a description of each option.
 
Additional information that may be used for accounting or troubleshooting purposes, such as an accounting ID
CURRENT CLIENT_ACCTNG register (DB2 for Linux/UNIX/Windows) or CLIENT ACCTNG register (DB2 for z/OS).
CURRENT CLIENT_APPLNAME register (DB2 for Linux/UNIX/Windows) or CLIENT APPLNAME register (DB2 for z/OS). For DB2 V9.1 and higher for Linux/UNIX/Windows, this value is also stored in the APPL_NAME value in the SYSIBMADM.APPLICATIONS table.
CLIENT_IDENTIFIER attribute. In addition, this value is also stored in the PROGRAM value in the V$SESSION table.
Host name of the client on which the application using the connection is running
CURRENT CLIENT_WRKSTNNAME register (DB2 for Linux/UNIX/Windows) or CLIENT WRKSTNNAME register (DB2 for z/OS).
User ID for whom the application using the connection is performing work
CURRENT CLIENT_USERID register (DB2 for Linux/UNIX/Windows) or CLIENT USERID register (DB2 for z/OS).
The name of a stored procedure or the name of the application
CLIENT_PRDID value. For DB2 V9.1 and higher for Linux/UNIX/Windows, the CLIENT_PRDID value is located in the SYSIBMADM.APPLICATIONS table.