If I have a database installed in a machine which can be accessed by different machines on the network, how can connection pooling be achieved? 1. Is it possible for a ConnectionPool class to pool connections for all machines in the network? Or does each machine have to just manage its own connections and no-one else's? 2. Do I have to install a server like Apache/Tomcat, to be able to manage connections for ALL machines on the network? Please note that this is in the context of JAVA APPLICATIONS, trying to connect directly to the database. I hope this makes sense... thanx Fabricio
Joined: Jan 23, 2002
Connection pools are local to the JVM you're running on, so no, you can't pool several machine's JDBC connections (unless it's actually a cluster).
Fabricio: I think there is a confusion as to what you are asking. From the post, it sounds to me that you think the connection pool is for database instead of your application. Any modern database can support multiple connections at a time. So database is not the one that has to worry about pooling, it's your application. In this case, your application that needs multiple connections. So, your application is the one that needs to manage connectin pooling. As for your question: 1. Is it possible for a ConnectionPool class to pool connections for all machines in the network? Or does each machine have to just manage its own connections and no-one else's? The answer is yes and no, once again, it depends on your application. If your application is standalone that runs on each machine, then the answer is NO. On the other hand, if your application is web-based, and all your machines uses the web application, then you only need web application to handle connection pool. Also, in the third case, if you are running RMI, I never done this before, you should be able to get connection from remote pool. 2. Apcahe/Tomcat has nothing to do with pooling, it supports pooling, but for their own server environment. One more point: depends on the complexity of your pooling class, it can be a nightmare to manage and trouble-shoot. I rarely seem a standalone application that requires more than a few connections. So the overhead for creating connection pool might not be worth it. If you insist on using connection pool, try the jakarta common pooling and DBCP library. www.apache.org