Search code examples
javajdbcwebsphere

How to read pool name from a Connection?


I'm using a Connection via severals pools :

 DataSource ds = initialContext.lookup("poolname1");
 Connection cn = ds.getConnection();
 submethod1(cn);
 submethod2(cn);

 void submethod1(Connection cn)
 {
      // using connection
      // ..
 }

My question is: how to log "poolname" in submethods ? or similar informations about DataSource.


Solution

  • Perhaps this will help

    getClientInfo()
    

    or

    getMetaData() 
    

    as mentionned in the Official Java Doc