Summary


This chapter shows how to use a custom pool as a performance enhancement for managing connections to a database. Interestingly, this can be done explicitly as a pool, or implicitly by injecting the pool at the driver level. While the Pool package, described in Chapter 5, "Pool," can be used to build generic pools, the DBCP is custom-built to address the common task of connecting to a database.

Project Ideas

Given a Swing application that accesses a database in some fashion, add a user interface element that displays the number of database connections currently in use (perhaps a "throbber" similar to the network connection user interface widget in a web browser).

Given a trivial SQL statement, write a utility to check the performance of DBCP versus opening and closing connections explicitly via JDBC. If you have an application container (such as Apache Jakarta Tomcat) that provides a connection pool (perhaps obtainable via JNDI), how does the performance compare?




    Apache Jakarta Commons(c) Reusable Java Components
    Real World Web Services
    ISBN: N/A
    EAN: 2147483647
    Year: 2006
    Pages: 137
    Authors: Will Iverson

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net