WebSphere Application Server & Liberty

WebSphere Application Server & Liberty

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only

Connection.setClientInfo() with ORMs and WAS

  • 1.  Connection.setClientInfo() with ORMs and WAS

    Posted 01/25/12 05:36 PM
    We are looking into passing additional connection information to a DB2 backend to help assist debug efforts.

    With WAS 7, there is the possibility of setting information with the client information fields that gets passed with the SQL on a Type 4 driver.

    The examples I've seen directly access the connection in order to set the client information.  Has anyone done this while using an ORM framework?  We are able to access the connection through either OpenJPA or Hibernate, but received a not implemented exception when calling setClientInfo(...).  With Hibernate, the debugger shows that a "com.ibm.ws.rsadapter.jdbc.WSJccSQLJConnection" proxy is assigned to the connection variable.

    Any ideas?

    Example:

    Class.forName("com.ibm.db2.jcc.DB2Driver");
    Properties props = new Properties();
    props.setProperty("user", "guard");
    props.setProperty("password", "password");
    Connection  connection = DriverManager.getConnection("jdbc:db2://10.10.9.28:50001/orders", props);


    connection.setClientInfo("ClientUser", "fbrooks");
    execSelectOnItems(connection);


    connection.setClientInfo("ClientUser", "kzuse");
    execSelectOnItems(connection);