It's hard to give a definitive answer w/out knowing your environment, but this often comes up in a webserver environment. If that is your case you are lucky since most webservers provide a JNDI-lookup capability, and built-in or third-party resource pooling be it JDBC connections, Mail sessions, or whatever. It may not be useful to launch into too much detail, but in a Tomcat environment you can define a resource and then access it via a JNDI-lookup in the application (Servlet, bean, JSP, etc.) If you provide a little more information about your runtime environment someone can give you a more detailed answer.
Joined: Sep 05, 2003
My environment does not include any application servers or web servers, just a plain JRE.
Originally posted by L Gu: Phile: I have more than one JVM running. Each application runs as a standalone server.
Sounds like you should use RMI. You won't be able to pass the connection (they aren't serializable) so you will need to write an app to do the actual db access and pass back a RowSet object (assuming you are doing select statements).
Thomas: First, thanks for you reply. However, If I use the solution you suggested, I have to rewrite all of my applications. So currently, I really want to just have a connection pool shared by all applications, and only replace few lines code on each application. Anybody have a good solution?
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: What is the best way to share database connection pool?