If you only need this for debugging I can give you some code to patch the BasicDataSource but this is unsupported code! (not thread-safe)
Add the following code to AbandonedObjectPool:
public List getTrace() {
return trace;
}And this to BasicDataSource:
public GenericObjectPool getConnectionPool() {
return connectionPool;
}And enable the abandonedpool by setting removeAbandoned=true in your config.
Now you can do:
DataSource ds = ... lookup ...
BasicDataSource bds = (BasicDataSource) ds;
AbandonedObjectPool pool =
(AbandonedObjectPool) bds.getConnectionPool();
List trace = pool.getTrace();
AbandonedTrace[] traces =
(AbandonedTrace[]) trace.toArray(new AbandonedTrace[trace.size()];
for (int i = 0 ; i < traces.length ; i++ ) {
traces[i].printStackTrace();
}Another solution would be to keep your own list somewhere (the easiest way to add that code would be in the PoolableConnectionFactory).
If several people want this feature then we can add it to the base component. Maybe we can start a wish list on the DBCP wiki page.
-- Dirk
Indio wrote:
how can i obtain the list of each active connections assigned by the pool? i'd like also to know to who was assigned regards!
this is my config
<Resource name="jdbc/dbConnection" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/dbConnection"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <parameter> <name>driverClassName</name> <value>net.sourceforge.jtds.jdbc.Driver</value> </parameter> <parameter> <name>url</name> <value>jdbc:jtds:sqlserver://sqlserver/DB1</value> </parameter> ... </ResourceParams>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
