WebSphere Application Server - Express, Version 6.0.x     Operating Systems: AIX, HP-UX, Linux, Solaris, Windows

Example: setClientInformation(Properties) API

Usage Scenario

This API enables you to set client information on the WebSphere Application Server connection. Some of the client information is passed on to the backend database if that database supports such functionality.

Example

import com.ibm.websphere.rsadapter.WSConnection;
.....
try {
   InitialContext ctx = new InitialContext();
   //Perform a naming service lookup to get the DataSource object.
   DataSource ds = (javax.sql.DataSource)ctx.lookup("java:comp/jdbc/myDS");
  }catch (Exception e) {System.out.println("got an exception during lookup: " + e);}

  WSConnection conn = (WSConnection) ds.getConnection();
  Properties props = new properties();
  props.setProperty(WSConnection.CLIENT_ID, "user123");
  props.setProperty(WSConnection.CLIENT_LOCATION, "127.0.0.1");
  props.setProperty(WSConnection.CLIENT_ACCOUNTING_INFO, "accounting");
  props.setProperty(WSConnection.CLIENT_APPLICATION_NAME, "appname");
  props.setProperty(WSConnection.CLIENT_OTHER_INFO, "cool stuff");
  conn.setClientInformation(props);
  conn.close()

Parameters

props contains the client information to be passed. Possible values are:
  • WSConnection.CLIENT_ACCOUNTING_INFO
  • WSConnection.CLIENT_LOCATION
  • WSConnection.CLIENT_ID
  • WSConnection.CLIENT_APPLICATION_NAME
  • WSConnection.CLIENT_OTHER_INFO
  • WSConnection.OTHER_CLIENT_TYPE
Refer to the WSConnection documentation for more details on which client information is passed to the backend database. To reset the client information, call the method with a null parameter.

Exceptions

This API creates an SQL exception if the database issues an exception when setting the data.

Reference topic    

Terms of Use | Feedback

Last updated: Jun 8, 2005 12:45:23 PM EDT
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/rdat_clientinfoex1.html

© Copyright IBM Corporation 2004, 2005. All Rights Reserved.
This information center is powered by Eclipse technology. (http://www.eclipse.org)