You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2003/09/12 15:58:27 UTC
DO NOT REPLY [Bug 23138] New: -
getDelegate no longer useful since v1.7 of PoolingDataSource
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: commons-dev@jakarta.apache.org
ReportedBy: pqin@shareowner.com
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:Phillip.Qin@shareowner.com]
>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:Phillip.Qin@shareowner.com]
>Sent: September 11, 2003 1:32 PM
>To: commons-user@jakarta.apache.org
>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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org