Bug 48392 - jdbc-pool is not returning the proxied connection in resultSet and statement
jdbc-pool is not returning the proxied connection in resultSet and statement
Status: RESOLVED FIXED
Product: Tomcat Modules
Classification: Unclassified
Component: jdbc-pool
unspecified
PC Windows XP
: P2 critical (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2009-12-15 11:43 UTC by gfernandes
Modified: 2011-09-12 15:25 UTC (History)
1 user (show)



Attachments
JdbcInterceptor to proxy resultSets and statements (6.22 KB, text/plain)
2009-12-16 11:26 UTC, gfernandes
Details
Statement decorator interceptor that proxies the resultSet and statement. (7.16 KB, text/x-java)
2010-02-24 18:06 UTC, gfernandes
Details
A correction to the createDecorator() method in the interceptor (10.27 KB, text/x-java)
2011-09-05 08:54 UTC, Neil Clarke
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gfernandes 2009-12-15 11:43:20 UTC
The proxy connection returned by the jdbc-pool is not proxying the resultSet and the statement so if the client gets access to the underlying connection through: 

resultSet.getStatement().getConnection()

He is able to close the physical connection due to both instances (resultSet and statement) were not proxied. 
If this happens next time a client gets a connection from the jdbc-pool it will return a proxy with a physical connection closed.
Comment 1 gfernandes 2009-12-15 12:08:01 UTC
jdbc-pool version is: 1.0.7.1
Comment 2 gfernandes 2009-12-16 11:26:26 UTC
Created attachment 24713 [details]
JdbcInterceptor to proxy resultSets and statements

Implemented a JdbcInterceptor to proxy resultSets and statements.
Comment 3 Konstantin Kolinko 2009-12-16 19:10:14 UTC
For reference: link to the discussion thread on users@:
http://markmail.org/thread/lf4l3tjy5eev5kxo
http://marc.info/?t=126089853000004&r=1&w=2
Comment 4 Filip Hanik 2010-02-24 17:44:08 UTC
The patch contains a package name we can't use, and it doesn't have any license header in it.

Can you adjust the package name to 
org.apache.tomcat.jdbc.pool.interceptor

and add the license header (just look at an existing source file)
Comment 5 gfernandes 2010-02-24 18:06:13 UTC
Created attachment 25054 [details]
Statement decorator interceptor that proxies the resultSet and statement.

Corrected the package and added the license header as suggested by Filip.
Comment 6 Filip Hanik 2010-02-24 19:28:36 UTC
Thank you for the patch. It's been committed with a change to org.apache.juli.Log instead of Log4j
Comment 7 Neil Clarke 2011-09-05 08:54:34 UTC
Created attachment 27457 [details]
A correction to the createDecorator() method in the interceptor

There appears to be a typing error in the createDecorator() method of the interceptor, setting the connection to the constructor object:

statementProxy.setConnection(proxy);
statementProxy.setConstructor(constructor);
Comment 8 Filip Hanik 2011-09-12 15:25:29 UTC
Thank you
Fixed in r1169796