Two more comments on this. First, by modifying the jsp to cast the ds
as a SharedPoolDataSource, you can call the getNumActive and
getNumIdle methods to verify that the pool is working correctly:
<jsp:directive.page
import="org.apache.tomcat.dbcp.dbcp.datasources.SharedPoolDataSource"
/>
...
SharedPoolDataSource ds = (SharedPoolDataSource)
envContext.lookup("jdbc/MyPool");
System.out.println("DataSource: " + ds);
System.out.println("Num Active init " + ds.getNumActive());
System.out.println("Num Idle init " + ds.getNumIdle());
Connection conn1 = ds.getConnection("phil", "zft0done");
System.out.println("Connection 1: " + conn1);
System.out.println("Num Active one open " + ds.getNumActive());
System.out.println("Num Idle one open " + ds.getNumIdle());
...
For PerUserPoolDataSource, you need to supply uid/pwd to the getNumXxx
methods per the javadoc to get correct counts.
For SharedPoolDataSource, I get the expected output with the setup I
described above:
DataSource: [EMAIL PROTECTED]
Num Active init 0
Num Idle init 0
Connection 1: [EMAIL PROTECTED]
Num Active one open 1
Num Idle one open 0
Connection 2: [EMAIL PROTECTED]
Num Active two open 2
Num Idle two open 0
Num Active 2 closed 1
Num Idle 2 closed 1
Connection 3: [EMAIL PROTECTED]
Num Active 3rd open 2
Num Idle 3rd open 0
Num Active 1 closed 1
Num Idle 1 closed 1
Num Active all closed 0
Num Idle all closed 2
Second, if for some reason your version of the Oracle drivers is not
working correctly, you can use a cpds adapter. See the Wiki example
referenced above or the package javadoc for o.a.c.dbcp.cpsdadapter for
info on how to configure this.
Phil
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]