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) you can also set the client information as a data source property.
WebSphere Application Server before Version 6.0 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 WebSphere Application Server Version 6.0, you can set the client information
on some connections and not others, and you can set different client information
on different database connections from the same data source. You can pass
client information in one of two ways:
- Explicitly, by calling a proprietary API, setClientInformation(Properties) on
the com.ibm.websphere.rsadapter.WSConnection.
- Implicitly, using the WAS.clientinfo trace string. You can enable
this dynamically from the administrative console just like a normal trace.
For more information about passing client information implicitly, see Implicitly set client information.
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 WebSphere Application Server 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.