Database Connection Pooler

Discussions

General J2EE: Database Connection Pooler

  1. Database Connection Pooler (3 messages)

    For some time now we have been using our own home grown database connection pooler. I have for some time wanted to use a third party pooler because I did not want to worry about the maintainence/bug fixes. I just found some issues with it and looking through the code I don't get any warm fuzies that there are not many other bugs. I looked briefly at the DBCP pooler at apache. We use many apache tools and api's so I feel pretty confident in using their pooler. Has anyone used it and is there anyother good database pooler products?
  2. Database Connection Pooler[ Go to top ]

    Hi!

    Is your code running in a Web container or an EJB container? If that is the case, you should rely on the application server for connection pooling.

    /Tomas
  3. We use tomcat but we also have standalone java processes that run by themselves but both use the same Database Pooler. That is why I was considering DBCP from apache. We use tomcat right now and that is the pool it actually uses underneath. But if we use or own configuration we can switch app servers with no configuration changes.
  4. Hi,

    My recommendation is to write a Service Locator with a method getConnection(). Combined with a SingletonRegistry, this allows you to switch the actual way of getting a connection without changing client code. However, note that the transaction handling will work different in the EJB container since the container itself is a transaction monitor. (In the Web container you will get connections with auto commit set to true, and this can cause problems if you are unlucky.)

    Writing you own connection pool will, of cause, work. But note that you are then breaking the J2EE specification. Som if "comply to the spec" is important (for some political och commercial reason), you should be careful. Or just "forget" to say something :-)

    /Tomas