Passing client information to a database

Some databases enable you to set client information on the database connections using a backend-specific proprietary connection API. For some databases (such as DB2) one can also set the client information as a data source property. WebSphere Application Server before v6 only enables setting the client information as a data source property. This capability is somewhat limited, however, because the client information cannot be dynamically changed on the data source or the connections obtained from that data source. Also, setting the client information on the data source causes all connections created from that data source to have the same information. For example, if you set the ApplicationName as part of the data source clientInformation, all connections from that data source have the same application name. Because many different applications can access the same data source, this might not be desired.

With WAS v6, one can set the client information on some connections and not others, and one can set different client information on different database connections from the same data source. We can pass client information in one of two ways:

The API is defined on the WSConnection class which is part of the com.ibm.websphere.rsadapter package. You must cast your database connection in your applications to com.ibm.websphere.rsadapter.WSConnection before calling the API, as this is a WAS proprietary API. The API takes a properties object as an input parameter that provides the flexibility of adding new client information if and when it is introduced by the backend database, without any changes to this API itself.

public void setClientInformation (Properties props)throws SQLException;

For an example of using this API, see Example: setClientInformation(Properties) API.

 

See also


Example: setClientInformation(Properties) API
Implicitly set client information