I see. Then you'll need to do the "isProxy" method and check for SimplePooledConnection as the invocation handler. Then you can call the getRealConnection() method - which may return a further proxied object if logging is enabled. Proxy upon proxy - it can get complex to unwind these things.
I have to wonder - is this really necessary? You can probably set the value you mentioned as a driver property and not have to write all this untangling code. Jeff Butler On Jan 24, 2008 12:33 PM, Hugh Ross <[EMAIL PROTECTED]> wrote: > In my debugger, it looks like my Proxy is > actually SimpleDataSource-related, not logging. And, SimpleDataSource seems > to have a method to unrwrapConnection(). Still digging... > > > On 1/24/08, Jeff Butler <[EMAIL PROTECTED]> wrote: > > > > I just checked SVN and that method was indeed added in 2.3. I'll add > > that information to the WIKI page. > > > > There's no other way to the underlying Connection object unless you > > disable logging in all circumstances, or you write some custom reflection > > code that gives you access to the private field. Upgrading to 2.3 is > > much easier (I would say that 2.3 is quite stable - it's been out over a > > year). > > > > Jeff Butler > > > > > > On Jan 24, 2008 11:56 AM, Hugh Ross <[EMAIL PROTECTED]> wrote: > > > > > > > > Thanks, Jeff. I'm not finding a getConnection method in the > > > ConnectionLogProxy class. Is that because I'm using iBATIS 2.2.0? If > > > so, is there another way to get the underlying Connection object? > > > > > > > > > On 1/24/08, Jeff Butler <[EMAIL PROTECTED] > wrote: > > > > > > > > This comes up a lot! I just added a WIKI page describing the > > > > process: > > > > > > > > http://opensource.atlassian.com/confluence/oss/pages/viewpage.action?pageId=15597591 > > > > > > > > > > > > Jeff Butler > > > > > > > > > > > > > > > > On Jan 24, 2008 10:03 AM, Hugh Ross <[EMAIL PROTECTED]> wrote: > > > > > > > > > Can anyone provide some sample code for this? > > > > > > > > > > I tried, but seemed to be blocked by $proxy objects or odd looking > > > > > com.ibm.db2.jcc.b.b objects... > > > > > > > > > > For example, this did not work for me: > > > > > > > > > > java.sql.Connection conn = > > > > > sqlMapClient.getCurrentConnection(); > > > > > > > > > > if (conn instanceof com.ibm.db2.jcc.DB2Connection ) > > > > > { > > > > > com.ibm.db2.jcc.DB2Connection db2conn = ( > > > > > com.ibm.db2.jcc.DB2Connection)conn; > > > > > db2conn.setDB2ClientApplicationInformation > > > > > ("SomethingUsefulHere"); > > > > > } > > > > > > > > > > I also tried getting the DataSource 1st. > > > > > > > > > > Thanks! > > > > > > > > > > > > > > > > > > > > > > > >