Saturday, April 24, 2010

JDBC Connection Pool - Minimalist Options

Revisiting database connection management. I took a look at C3P0 which is an open source JDBC driver and looks pretty simple to use.

The only thing I don't like about downloading some of these libraries is the amount of code contained in them I don't really need. I looked at the source and don't need anything for JBoss, for instance. I prefer simplicity and minimalist code, personally. Just to get some functionality in Eclipse I have to download fifty bazillion classes. Yes, bazillion.

And have some other personal reasons for not wanting to use all the J2EE stuff for managing resources. It's my code, so I don't have to conform to the masses in this case. When developing for another company I would probably have to follow Java law.

So anyway I found this interesting example as a starting point for a JDBC connection pool without all the extraneous stuff I don't need:

JDBC Connection Pool - Example Code

I'm sure this needs revisions and not completely what I need (already found it did not override a bunch of things now in the connection interface and is using out of data classes per some documentation I ran across) but maybe something between the two would be nice.

Maybe if components you download had a way to specify and get only the functionality you need when you get them instead of downloading every option under the Sun...no pun intended ;-)