6 Client Information for Connections : How Databases 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 data provider caches the information locally. Similarly, if an application returns client information and the database does not provide a mechanism for storing that information, the data provider returns the locally cached value.
For example, let’s assume that the following code returns a pooled connection to a DB2 V9.1 for Linux/UNIX/Windows database and sets a client application name for that connection. In this example, the application sets the application name SALES157 using the data provider Application Name connection string option.
// Get Database Connection
Db2Connection conn = new DB2Connection("...;Application Name=SALES157;");
conn.Open();
//
// do something
//
conn.Close();
SALES157 is stored by the DB2 database in the CURRENT CLIENT_APPLNAME register, the location that DB2 reserves for this information. When the connection to the database is closed, the connection is returned to the connection pool as usual and the client information on the connection is reset to an empty string.