kevin maloney

+ Follow
since Dec 19, 2005
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by kevin maloney

Hi --

I'm relatively new to Java, for the last few months I've been grappling with an issue related to connection pooling. Every example of pooling or tutorial on pooling that I've seen (including your own) requires that any database connection that you want to pool must be defined in configuration files that are bound and deployed with the application. (I'm thinking of files such as your "DBCPConfiguration.xml", or my own environment's "WEB-INF/web.xml" and "META-INF/data-sources.xml" files, although I understand that the specific names and locations may vary depending on the server environment chosen.)

In my app incorporating the database definitions (such as database name, instance, connect strings, etc.) inside these source files just isn't appropriate for a large number of reasons -- the most significant of which is that everything (including the number of database my app needs to talk to) needs to be configurable at run time by the app's administrators from within the application. The process of adding new databases has to be made easy for them, and can't require altering configuration files in source code and redeploying the application.

My approach has been to just dynamically create conventional connections, and assign connect strings at run time (the connect strings are retrieved from a core control database that I do pool), and forego the benefits of pooling. It works fine, and I'm happy with it, until I read articles like yours and start to think about it. I understand the benefits of connection pooling -- and in fact ran a bunch of metrics that tell me how much better my app would perform if I could use it.

After all that intro, my question is fairly simple: is there any way to use connection pooling without knowing in advance the number of databases you'll have to connect to, and all of their various connection parameters?

Can't say for sure whether this will help, but _sometimes_ the client-side routines for parsing responseXML barf silently if the content isn't correctly formed. There have been two approaches I've used to identify and solve this:

1) on the server, write out the complete contents that you're outputting (for example, using System.out.println) then copy that from your server output log to an XML validator.

2) on the client, pick up the results NOT as responseXML, but as responseText(), then issue a client-side alert() -- copy the contents of the alert box to an XML validator.

Typically if I run into the problem you describe it's because of some unexpected flakiness in my data: for example, an ampersand or angle-bracket inside one of my data elements, or some other bizarre data anomaly.

Hope this helps.