3 messages in com.mysql.lists.javaRe: Newbie alert :-) Pooled Database ...
FromSent OnAttachments
Dave Peckham04 Jan 2000 21:44 
Chris Albone05 Jan 2000 11:31 
Tom Myers06 Jan 2000 05:47 
Subject:Re: Newbie alert :-) Pooled Database Connections
From:Tom Myers (tom.@postoffice.worldnet.att.net)
Date:01/06/2000 05:47:20 AM
List:com.mysql.lists.java

A footnote on a thread that just went by...

Chris Albone said

I am a complete newbie to the whole Java/Beans/Servlets/etc thing, so apologies up front I am about to ask some very stupid questions ;-)

We are currently updating some old servlets (written under version 2.0 of the Servlet specs) to run under tomcat (which runs a newer version of the Servlets specs). We need to provide pooled, persistant database connections to these servlets. We also need to be able to support a number of different flavors of database (Sybase and MySQL being the two main ones). Now the questions.. I assume that this is a problem that many people here have already had to deal with... So, what solutions have people come up with? Can anyone provide me with some pointers to (Open Source) database connection managers?

and Dave Peckham replied

Try JDBC Pool Version: 0.94 (Release Date: December 29, 1998) from bitmechanic.org.

and that looks like good advice, but if as a newbie you're looking for open source code to pick up ideas from I'd also suggest that you look at the connection pool classes in books... Hunter's Servlet Programming

http://www.amazon.com/exec/obidos/ASIN/156592391X (1998)

has a cool way of using hash tables to keep pools around, and my own

http://www.amazon.com/exec/obidos/ASIN/1861002858 or http://shop.barnesandnoble.com/booksearch/isbnInquiry.asp?isbn=1861002858

(It's just out, and amazon and b&n both have the authorlist and pagecount wrong, while amazon also has the title wrong; it's actually Nakhimovsky & Myers, _Professional Java Xml Programming with Servlets and JSP_, Wrox)

We do it by having the connection-manager class extend a Cache class which makes it easy to define other cached classes; we also use a PropertyGroups class for reading somewhat-structured properties files. (Emphasis code re-usability, of course, whereas I read Hunter as emphasizing elegance/brevity.) It all depends on what you want; the bitmechanic.org class will certainly have been tested by more people.

(Incidentally, I don't see any pooling in the Yarger/Reese/King "MySQL & mSQL" which I'd expect a large fraction of this list to have handy; none at all. Puzzling.)