tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John McNally <>
Subject Re: Connection pooling doesn't work for me ... Help !!
Date Thu, 13 Jun 2002 21:25:25 GMT

> >
> > In your code:
> >
> > Context initCtx = new InitialContext();
> > OracleConnectionPoolDataSource ocpds =
> > (OracleConnectionPoolDataSource)initCtx.lookup("mydb");
> > PooledConnection pooledConnection = ocpds.getPooledConnection();
> > Connection connection = pooledConnection.getConnection();
> > Statement statement = connection.createStatement();
> > ResultSet resultSet = statement.executeQuery(sql);
> >

This is not the correct way to to use a ConnectionPoolDataSource.  An
application should only interact with DataSource's.  I don't know oracle
jdbc drivers very well, but I assume that they provide a DataSource
implementation and if you do not care to have connection pooling you
should use that.

A ConnectionPoolDataSource does not provide connections that are pooled
somehow internally.  It is meant to be used by application servers or
other middle-ware software which might include connection pooling.  This
middle-ware layer will present a DataSource front-end for applications
to use and the ConnectionPoolDataSource will be used as its source of
physical connections.  

If you are looking for a connection pool that will use the
ConnectionPoolDataSource provided by oracle, you can find one in
jakarta-commons-sandbox/jdbc2pool.  It is the Jdbc2PoolDataSource class.

john mcnally

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message