With this API, set WebSphere Application Server client information on connections to pass that information to your database.
The following example code calls setClientInformation(Properties) on the com.ibm.websphere.rsadapter.WSConnection object.
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()
This API creates an SQL exception if the database issues an exception when setting the data.
Passing client info to a db cdat_clientinfo