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?