tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Will Stranathan <>
Subject Tyrex Pools
Date Tue, 02 Oct 2001 03:11:10 GMT
I started doing a little testing on the Tyrex pools on my local machine, 
and it doesn't appear to actually be pooling the connections.  In a 1 
minute period, I managed to get 118 hits (none of the connection lasted 
for the entire minute - they lasted at most 5 seconds) and I checked my 
outgoing connections, and had 128 (I'm assuming my stress-tester didn't 
count 10 connections that were active when I told it to stop.)

Anyhow, the point is, every time I request a connection from the pool, 
I'm getting a brand new connection - not a recycled one.  I'm calling 
close() on the connection in a finally block (and it is getting called). 
  Is there something else I have to do on the DataSource to ensure that 
the connection gets recycled properly?  Or am I missing some 
configuration in my server.xml?

Will Stranathan

Connection conn = null;
try {
     Context ctx = new InitialContext();
     DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/Directory");
     conn = ds.getConnection();
     // etc.
} catch (Exception e) {
} finally {
     try {
         System.out.println("closed connection");
     } catch (Exception ex) {
         System.err.println("Error closing connection");

<Resource name="jdbc/Directory" auth="SERVLET"
<ResourceParams name="jdbc/Directory">

View raw message