Hello My project builds an application that runs on WAS 7.0 and uses OpenJPA 2.0.1 persistence provider. We are also looking at using trusted context and trusted connection when connecting to DB2 9.7 database. Problem is that after setting up trusted context on DB2 side and configuring WAS data source and application resource reference authentication reference trusted context still does not work as expected. The database connection is not reset to current user. We received a reply from IBM support stating that trace log suggests that connection is not being reset for the current user because wrong method is used: getConnection() instead of getDB2Connection(). As we use OpenJPA and do not manage connections directly I assume EntityManager or other OpenJPA component is responsible for the call.
I would appreciate anyone having experience in implementing similar solution providing me any guidance. Is there any configuration on persistence unit that can be done to force OpenJPA to call getDB2Connection instead of getConnection()? Is there any specific interface we would need to implement or class to extend? I looked at ConnectionDecorator and thought about implementing my own that would be returning DB2PolledConnection wrapper which would overwrite getConnection() to actually use getDB2Connection. I am not sure however if that is the best approach. I am attaching the trusted context trace. Any help is welcome. [jcc][Connection@649c649c] BEGIN TRACE_CONNECTS [jcc][Connection@649c649c] Successfully connected to server jdbc:db2://localhost:50000/T2E2E [jcc][Connection@649c649c] User: DSAPPID <---------------------------- FIRST INSTANCE OF USER ID [jcc][Connection@649c649c] Database product name: DB2/NT [jcc][Connection@649c649c] Database product version: SQL10010 [jcc][Connection@649c649c] Driver name: IBM DB2 JDBC Universal Driver Architecture [jcc][Connection@649c649c] Driver version: 3.62.56 [jcc][Time:2012-11-02-13:34:19.406][Thread:WebContainer : 0][Connection@649c649c] getDB2Correlator () returned 127.0.0.1.12263.121102183419 [jcc][Connection@649c649c] DB2 Application Correlator: 127.0.0.1.12263.121102183419.0000 [jcc][Connection@649c649c] END TRACE_CONNECTS [jcc][t4] DRDA manager levels: { SQLAM=10, AGENT=10, CMNTCPIP=8, RDB=8, SECMGR=9, XAMGR=7, SYNCPTMGR=7, RSYNCMGR=5 } [jcc][Time:2012-11-02-13:34:19.406][Thread:WebContainer : 0][Connection@649c649c] setDB2ClientWorkstation (null) called [jcc][Time:2012-11-02-13:34:19.406][Thread:WebContainer : 0][DB2ConnectionPoolDataSource@2f402f4] getDB2TrustedPooledConnection () returned [Ljava.lang.Object;@64846484 [jcc][Time:2012-11-02-13:34:19.406][Thread:WebContainer : 0][DB2PooledConnection@64876487] getConnection ([B@60146014, aadamcz, <escaped>, null, null, server:DefaultNode_DefaultNode_WebSphere_Portalnull) called [jcc][Time:2012-11-02-13:34:19.406][Thread:WebContainer : 0][Connection@649c649c] reuse ([B@60146014, aadamcz, <escaped>, null, null, server:DefaultNode_DefaultNode_WebSphere_Portalnull) called [jcc][Connection@649c649c] DB2 LUWID: 127.0.0.1.12263.121102183419.0001 [jcc][Connection@649c649c] BEGIN TRACE_CONNECT_RESET [jcc][Connection@649c649c] Successfully reset connection to server jdbc:db2://localhost:50000/T2E2E [jcc][Connection@649c649c] User: DSAPPID <----------------------------- NO SWITCH IN USER ID TAKES PLACE -- View this message in context: http://openjpa.208410.n2.nabble.com/DB2-trusted-context-with-OpenJPA-2-0-1-tp7581661.html Sent from the OpenJPA Users mailing list archive at Nabble.com.