Super explanation, Craig. I've taken a look at the Tyrex site and think I'm correct in saying that there is no caching of database results. Is this true ?
I understand that database connections take longer than queries so the connection pooling creates the greatest time saving, but I think result caching can also improve performance. Does Tomcat have a mechanism for doing this or is it up to us to build that into our own web-apps ? Is there a boilerplate for doing this ? Thank you, Soefara >From: "Craig R. McClanahan" <[EMAIL PROTECTED]> >Reply-To: "Tomcat Users List" <[EMAIL PROTECTED]> >To: Tomcat Users List <[EMAIL PROTECTED]> >Subject: Re: Managing Tomcat(4.0.x) JNDI JDBC pool resources - Craig? >Date: Sat, 16 Mar 2002 12:51:22 -0800 (PST) > > > >On Sat, 16 Mar 2002, Steven Elliott wrote: > > > Date: Sat, 16 Mar 2002 17:46:01 +0000 > > From: Steven Elliott <[EMAIL PROTECTED]> > > Reply-To: Tomcat Users List <[EMAIL PROTECTED]> > > To: [EMAIL PROTECTED] > > Subject: Managing Tomcat(4.0.x) JNDI JDBC pool resources - Craig? > > > > Apologies in advance if this has already been answered in another thread >but > > my searches have turned up numerous references to JNDI & pooling & JDBC >- > > etc. but only one post mentioned managing container (Tomcat) pool >resources > > and that question went unanswered as far as I could tell. Nor did I >find > > anything particullarly illuminating in the Tomcat documentation. At >least I > > haven't found the > > > > After reading the JDBC2.0 stdext documentation it seems that the >container > > does not use the driver's ConnectionPoolDataSource interface as a >factory > > for PooledConnection objects but instead (at least what I can tell from > > Tomcat) uses its own pooling resource? > > > >The container exposes a javax.sql.DataSource implementation to >applications. Internally, the factory is currently based on Tyrex >(http://tyrex.exolab.org) for 4.0.x, but has switched to the DBCP package >from Jakarta Commons (http://jakarta.apache.org/commons) in the nightly >builds. > > > What I don't see provided for is any kind of management methods to set >Min > > or Max Pool size, or setting the initial Pool size, etc. Nor do I see >any > > default values? Although I can set parameters for the DataSource object > > supported by my driver (like dataBaseName, etc. I think) I don't see any >way > > to get to the setter, getter methods supported by my driver's > > ConnectionPoolDataSource factory (beyond the methods declared in the >javax > > API)? > > > >Tyrex, and the DBCP pool, both do their own pool management of >java.sql.Connection instances provided by your driver, so they can be used >with any JDBC driver -- even those that do not support >ConnectionPoolDataSource themselves. The DBCP based pool does have >configuration management properties for pool size and so on. > > > Is there any way to configure these parameters for Tomcat? If not is >there > > any way to register a third party connection pool from within server.xml >or > > will this have to be done in a separate package. > > > >It should be possible to use the DBCP based pool even with Tomcat 4.0.x by >overriding the default JNDI factory for javax.sql.DataSource objects (I >haven't tested this, but in theory it should all work). >This requires the following steps: > >* Download recent nightly builds of the Collections, Pool, and DBCP > packages from Jakarta Commons > (http://jakarta.apache.org/builds/jakarta-commons/nightly/) and put > the JAR files into $CATALINA_HOME/common/lib along with your JDBC > driver. > >* Configure the "factory" parameter in the <ResourceParams> element > to set the JNDI ObjectFactory class for this resource: > > <ResourceParams name="jdbc/EmployeeDB"> > <parameter> > <name>factory</name> > <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> > </parameter> > ... other configuration parameters ... > </ResourceParams> > >* Configure the other parameter values of the <ResourceParams> element > from the list of supported properties below: > - driverClassName - Fully qualified Java class name of the JDBC driver > - maxActive - Maximum number of active connections at one time > - maxIdle - Maximum number of idle connections at one time > (if more are returned to the pool, they will be > closed to release database resources) > - maxWait - Number of milliseconds the pool will wait when there > are no available connections before causing > getConnection() to throw an exception > - password - Database password > - url - Connection URL (also accepts "driverName" for > backwards compatibility) > - user - Database username > - validationQuery - Optional SQL SELECT statement used to validate a > connection before returning it to the application > (must return at least one row). This is helpful > in catching stale connections because of timeouts > or recycling of the database without stopping > Tomcat. > >Alternatively, you can use any other connection pool you like, if you >create your own javax.naming.spi.ObjectFactory implementation class (the >JNDI object factory interface) and registering its name with the "factory" >parameter. Documentation is in the JNDI Specification and the >corresponding Service Provider Interface document, at: > > http://java.sun.com/products/jndi/docs.html > >You can use the BasicDataSourceFactory class from the Commons DBCP package >as a model. > > > Thanks for any ideas/help. > > > > Steven > > > >Craig > > >-- >To unsubscribe: <mailto:[EMAIL PROTECTED]> >For additional commands: <mailto:[EMAIL PROTECTED]> >Troubles with the list: <mailto:[EMAIL PROTECTED]> > _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]>
