RandomGUID (updated Nov 05, 2002).

This utility class generates cryptographically strong random GUIDs in the standard format.
Download Version 1.2.1  About RandomGUID

Note: 10x performance boost in the new 1.2.1 version! Thanks to Mike Dubman for submitting this change (see source for details).

Multi Tier Architectures for Database Connectivity (a white paper)

JavaExchange Products:

Release version 1.0.13 of DbConnectionBroker:
Db Connection Broker
DbConnectionBroker is a pure Java package for handling multiple concurrent database connections. DbConnectionBroker creates a broker with a very simple interface for handing out and returning database connections from a configurable pool of connections. The Broker creates a dynamic pool of connections and manages them for you with a background housekeeping thread.

The Connection Broker completely avoids the overhead required in establishing a new database connection (typically around 1 to 2 seconds) by reusing a collection of pre-established connections. This profoundly improves the performance for database-intensive applications where HTML pages/forms are either stored directly in a database or created on-the-fly from data or procedures stored in a database.

A Connection Broker is created in the context of a servlet. Each servlet desiring multiple concurrent DB connections has its own private Broker and private pool of connections. This method of handling multiple connections borrows all of the desirable features of dedicated, stand alone brokers (3 tiered architectures) but avoids much of the complexity inherent in them. The flexibility of containing the connection pool within each servlet as a class is desirable for small scale as well as large scale applications. The aim here is for a simple, scalable solution to the problem of multiple concurrent database connections with an emphasis on performance.

DbConnectionBroker is currently in use in several large database applications involving multi-thousand-hits-per-day traffic. In these applications, DbConnectionBroker has demonstrated its main target of superior database connectivity performance as well as its resilience to a variety of common connection and database specific errors.

DbConnectionBroker is free for all uses. It is hoped that through user feedback, this package will continue to mature and provide a useful tool for those of us working with server-side database applications.

The 2 Tier Architecture for database connectivity: DbConnectionBroker uses a 2 Tier approach to database connectivity. An analysis of this approach and how it compares to the 3 Tier approach is presented in my recent white paper Multi Tier Architectures for Database Connectivity.

Features of DbConnectionBroker:
  • Not Product Dependent.  Works with any Java Servlet Server (JWS, Servlet Express, JRun, etc.)  You don't have to commit your development time to a particular proprietary solution or product.  Build it once; run it anywhere!
  • Easy Configuration.  (Self-starting.  No server to keep track of.)
  • Works with any database accessible via JDBC
  • Dynamic pool sizing. User defines min and max connections; connections are added to pool as needed.
  • Error and event logging.
  • Robust. Recovers connections from most JDBC programming errors and database errors. Even recovers from a complete database shutdown and restart.
  • All activities are multithread safe.
  • Automatic Housekeeping activities.
  • Controlled shutdown (destruction) of pool allowing for multiple database fail-over capabilities. (see changes for version 1.0.13)


Download the JDBCGlobalBroker Kit Release 2.0.0 (See changes)

Note (7/28/99):After working with the 3 primary approaches to creating global connection pools, I have found that inheritance is by far the simplest and most elegant of the three. The JDBCGlobalBroker Kit has been changed to incorporate this approach. A quick explanation of the three approaches is provided below:

  1. Servlet Reuse. One servlet can be created to set up a two-tier connection pool while other servlets access the public methods of this servlet using the getServlet() method.
  2. Singleton. Servlets share a common object using the static declaration. Each servlet instantiates a global pool (the shared object) in its init section -- only the first servlet to be called actually creates the object; all subsequent servlets skip the instantiation if the object already exists. (This is the approach that has been provided in previous releases of the JDBCGlobalBroker Kit)
  3. Inheritance. A class is created which extends the HttpServlet class. Simply add a connection pool to this superclass. All servlets can then inherit and share the same pool by using the superclass. The connection pool is created using a singleton.

    The complete Kit for Global Connection Pools is now part of the DbConnectionBroker package (download now)

    HttpServletJXGB.java (here's the source code for the superclass)
    Readme.txt (what's the Global Broker all about?)
    GlobalBrokerExample1 (a basic example of a global broker)


    Download DbConnectionBroker Release 1.0.13 (See changes).:
    DbConnectionBroker1.0.13.tar (112K) (Updated 3/21/02) (See changes).
    Previous Versions

    Add the class files to your CLASSPATH or unzip it in the appropriate directory.


    DbConnectionBroker is in use in the following systems:
    The United Computer Exchange (Online Auctions)

    DbConnectionBroker, JDBCGlobalBroker and JSTemplate are written and distributed under Open Source Licenses.

    Your comments and suggestions are welcome at marc@javaexchange.com.

    Copyright 1996, All rights reserved.
    Marc A. Mnich marc@critters.com

    Java and HotJava are trademarks of Sun Microsystems, Inc., and refer to Sun's Java programming language and HotJava browser technologies, JavaExchange.com is not sponsored by or affiliated with Sun Microsystems, Inc.