tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Brunkow <>
Subject RE: Database Connectivity, JDBC2 and Tomcat
Date Fri, 28 Jul 2000 17:05:53 GMT
Is all of that necessary, if JDBC2.0(and the correct driver and database,
thanks Alexandros)works as advertised?


-----Original Message-----
From: Bill Pfeiffer []
Sent: Thursday, July 27, 2000 6:45 PM
Subject: RE: Database Connectivity, JDBC2 and Tomcat

AFAIK, the proper way to do what you want is to:

1. Create a "load" servlet that will initialize a connection pooling object
when the containter (Tomcat) starts up.  There are several connection
pooling offerings out there for free.

2. Have the "load" servlet load on container startup.

3. Have the "load" servlet store the connection pooling object in the
ServletContext object.  This will make the pool available to ALL sessions.

4. Have the individual servlet (or jsp's) get the connection pooling object
from the ServletContext.  Get the individual connections from the connection
pooling object and hold the connection for only as long as you need it, then
return it immediatly to the pool.  Usually this time period is specified by
the amount of work done within a logical transaction.

You may want to have a controlling object to:

  * obtain the connection,
  * begin the transaction,
  * pass the connection to the individual beans to do work,
  * commit or rollback the transaction as appropriate at the end of the work
  * return the connection

I have used an abbreviated version of this in all my current servlet/jsp
work.  I don't really do any updates just yet, so I don't have any
transactions to worry about, just read only data javabeans.

I do plan to integrate with jBoss to do my transactional type work when I
get to it.  Why re-invent the EJB wheel with regular javabeans when there
are good open source EJB solutions that will integrate with Tomcat?

My $.02,

Bill Pfeiffer
Arbitration Forums, Inc

-----Original Message-----
From: Daniel Le Berre []
Sent: Thursday, July 27, 2000 8:51 PM
Subject: Re: Database Connectivity, JDBC2 and Tomcat

> "Kotsiras, Alexandros" wrote:

> I am using  the connection pool from with great
> success. It has a couple
> of examples that clearly show how to use it.
> For mapping tables to objects and avoiding EJBs or a lot of trivial
> JDBC lines of code, have a look at SQL2Java (They
> also have their own Connection pool).

To do the same JOB (table->Java), I use TableGen, which is not bad:

The pooling used is Ewin Connection Pool:

      Daniel Le Berre
      Research Associate,
      School Of Management, S123, University of Newcastle, NSW 2308
      Australia   Tel: (02) 4921 {5009(Off), 7055(Lab.), 6911(Fax)}

View raw message