DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23138>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23138 getDelegate no longer useful since v1.7 of PoolingDataSource Summary: getDelegate no longer useful since v1.7 of PoolingDataSource Product: Commons Version: Nightly Builds Platform: All OS/Version: All Status: NEW Severity: Normal Priority: Other Component: Dbcp AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] Please refer to the communications between Dirk and I. Dirk's reply: OK, this needs to be fixed. I'll thinking about making PoolGuardConnectionWrapper a subclass of DelegatingConnection. and implement the getDelegate() & getInnermostDelegate() You can then do: Connection conn = dataSource.getConnection(); Connection dconn = ((DelegatingConnection) conn).getInnermostDelegate(); Make a bugzilla issue to keep track of this if you want. Cheers Dirk Phillip Qin wrote: >PoolGuardConnectionWrapper was introduced to fix "connection close >twice". However it didn't consider some one like me rely on getDelegate >to do something. I have removed PoolGuardConnectionWrapper from >PoolingDataSource and rebuilt my own branch of commons-dbcp based on >20030910 nightly build. Should I file a bug into bugzilla? > > -----Original Message----- >From: Phillip Qin [mailto:[EMAIL PROTECTED] >Sent: September 11, 2003 2:59 PM >To: 'Jakarta Commons Users List' >Subject: RE: [dbcp]PoolableConnection BUG? > >I think I figured it out. > >In version 1.7, PoolGuardConnectionWrapper was added to wrap around >PoolableConnection in PoolingDataSource. > > public Connection getConnection() throws SQLException { > try { >- return (Connection)(_pool.borrowObject()); >+ Connection conn = (Connection)(_pool.borrowObject()); >+ if (conn != null) { >+ conn = new PoolGuardConnectionWrapper(conn); >+ } >+ return conn; > >-: 1.6, +: 1.7 > >That's why the connection is not an instanceof PoolableConnection. > >Now my question is, > >I want to pass a SQL Array to Oracle stored procedure. In order to >create an array descriptor, Oralce's >ArrayDescriptor.createDescriptor(sqlArrayType, >conn) requires conn a java.sql.Connection. It doesn't recognize a connection >wrapper. In order to get the underlying Connection, I have to use >getDelegate method. In order to use getDelegate method, I have to get a >PoolableConnection or PoolGuardConnectionWrapper which has getDelegate >method. If PoolGuardConnectionWrapper is private, how am I supposed to >getDelegate? > >-----Original Message----- >From: Phillip Qin [mailto:[EMAIL PROTECTED] >Sent: September 11, 2003 1:32 PM >To: [EMAIL PROTECTED] >Subject: [dbcp]PoolableConnection BUG? > >BasicDataSource getConnection returns java.sql.Connection which is >actually org.apache.commons.dbcp.PoolableConnection. When I cast this >connection to PoolableConnection, I got ClassCastException. > >Connection conn = dataSource.getConnection(); >Connection dconn = ((PoolableConnection) conn).getDelegate() ; > >(PoolableConnection) conn throws ClassCastException. > >I didn't get the same exception in release 1.0. This happens on >snapshot 20030910 and 20030911. I also use commons-pool snapshot >20030910. Is it s bug? > > >Regards, >PQ > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
