You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by jm...@apache.org on 2002/01/14 08:10:55 UTC

cvs commit: jakarta-commons-sandbox/jdbc2pool - New directory

jmcnally    02/01/13 23:10:55

  jakarta-commons-sandbox/jdbc2pool - New directory

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-commons-sandbox/jdbc2pool - New directory

Posted by John McNally <jm...@collab.net>.
Randy Speh wrote:
> 
> Could you please give me hint on how the new jdbc2pool
> connection pool is supposed to be used?
> 
> I would like to use a OracleConnectionPoolDataSource
> to pool some connections and in another case I'd like
> to use a DataSource object managed by WebSphere.

The pool will use any ConnectionPoolDataSource (CPDS) as its backend
supply of physical database connections.  The backend datasource is
specified using the setDataSourceName method which is used to find the
CPDS using jndi.  The maximum number of connections can be configured on
a per user basis; the rest of the properties are set globally.

The Jdbc2PoolDataSource can be instantiated and initialized using
standard bean introspection methods.  So it should be deployable using
any tool meant for use with DataSources or general javabeans.  It does
use Properties for the per user maximum connections as well as the jndi
environment properties, which are both optional.  I do not know how well
these might be supported by the standard tools.  All the other
properties are String's or int's.  In torque the DataSource(s) can be
bound to jndi using a simple properties file to determine
initialization.

The internal pools are stored in a class attribute Map, so several
instances of the DataSource will share the same connections.  This
arrangement is given as an example in the specification.  A better cache
than a HashMap could be used to add more functionality, but such
optimizations are being left until the future of this pool code is
better determined.

Finally the pool can be initialized and used as a normal class, here is
an example using the DriverAdapterCPDS that comes with the pool:

DriverAdapterCPDS pcds = new DriverAdapterCPDS();
pcds.setDriver("org.gjt.mm.mysql.Driver");
pcds.setUrl("jdbc:mysql://localhost/test");
pcds.setUser("root");
pcds.setPassword("xxx");

Jdbc2PoolDataSource tds = new Jdbc2PoolDataSource();
tds.setConnectionPoolDataSource(pcds);
tds.setDefaultMaxConnections(10);
tds.setMaxExpiryTime(3600);
tds.setConnectionWaitTimeout(10);
tds.setLogInterval(300);

DataSource ds = tds;
...

Connection con = ds.getConnection();


john mcnally

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: jdbc2pool

Posted by Randy Speh <rw...@yahoo.com>.
Thanks for all your help on the jdbc2pool classes in
Torque.  Your work has been very helpful.


--- John McNally <jm...@collab.net> wrote:
> I just checked a database connection pool into the
> sandbox.  The pool is
> based on code that has been in use for more than 3
> years as part of
> turbine and torque.  The code was modified
> considerably to bring it up
> to date with the jdbc2 specification, so it needs
> testing of all sorts
> before it can be considered production quality.
> 
> I detailed the reasons why DBCP is not jdbc2
> compliant in README.txt. 
> The changes to DBCP are significant as well, so I am
> unsure of the DBCP
> developers intentions.  Hopefully the jdbc2pool code
> in the sandbox can
> be used to spur a quick update of the DBCP code.
> 
> Otherwise, I welcome anyone who would like to start
> adding tests and
> documentation.
> 
> john mcnally
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: jdbc2pool

Posted by Jon Scott Stevens <jo...@latchkey.com>.
on 1/14/02 9:59 PM, "John McNally" <jm...@collab.net> wrote:

> I just checked a database connection pool into the sandbox.  The pool is
> based on code that has been in use for more than 3 years as part of
> turbine and torque.

If I remember correctly, this was one of John's first tasks to write when he
started working at Clear Ink. :-) I think that was more than 3 years ago,
wasn't it?

-jon


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


jdbc2pool

Posted by John McNally <jm...@collab.net>.
I just checked a database connection pool into the sandbox.  The pool is
based on code that has been in use for more than 3 years as part of
turbine and torque.  The code was modified considerably to bring it up
to date with the jdbc2 specification, so it needs testing of all sorts
before it can be considered production quality.

I detailed the reasons why DBCP is not jdbc2 compliant in README.txt. 
The changes to DBCP are significant as well, so I am unsure of the DBCP
developers intentions.  Hopefully the jdbc2pool code in the sandbox can
be used to spur a quick update of the DBCP code.

Otherwise, I welcome anyone who would like to start adding tests and
documentation.

john mcnally

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-commons-sandbox/jdbc2pool - New directory

Posted by Randy Speh <rw...@yahoo.com>.
Could you please give me hint on how the new jdbc2pool
connection pool is supposed to be used?

I would like to use a OracleConnectionPoolDataSource
to pool some connections and in another case I'd like
to use a DataSource object managed by WebSphere.

It seems this code is going in a very flexible
direction and I realize it's not finished yet.  I was
just hoping you could share some of your vision for
how it will be used in the future.

Thank you,
Randy Speh

__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>