For any Java application outdoors of the J2EE container, which connection pool library is the greatest?

  • I heard c3p0 gets outdated.
  • Jakarta's common pool library is no more under development

Therefore I am playing BoneCP and DBPool. From what I will tell have limited activity. The primary difference I can tell is performance, which BoneCP appears to win by helping cover their. Nevertheless the documentation is fairly weak.

Which database pool library perhaps you have utilized in the real life and why? That which was the negative and positive?

At the office we've used BoneCP (because the alternative for c3p0) and so far as I understand haven't had any issues (I didn't perform the upgrade myself). From what I've come across and browse it appears just like a well-designed solid library, and that i would personally utilize it over options: it seems to become among individuals "just works" libraries which are nice to possess around.

Nothing negative to say of DBPool, I'm simply not familiar enough by using it although searching at its site documentation certainly appears just like a plus.

We use C3P0 in and outdoors of Tomcat. However, the monitoring and logging is not the finest, so we are likely to begin using the SpringSource connection pool. Among the best features I am searching toward is showing precisely what SQL claims are running at any particular time.

One factor we needed to increase C3P0 would be a way of timing how lengthy a specific connection request waits for any connection once the pool is full and all sorts of the connections are busy:

            public Connection getConnection() throws SQLException
            {
                    long t = System.currentTimeMillis();
                    ComboPooledDataSource ds = (ComboPooledDataSource) getDelegate();
                    Connection conn = null;

                    if (ds.getNumBusyConnections() == ds.getMaxPoolSize())
                    {
                            logger.info("Pool (" + ds.getUser() + ") full, waiting for connection");
                            conn = ds.getConnection();
                            t = System.currentTimeMillis() - t;
                            logger.info("Connection busy wait time (" + ds.getUser() + "): " + t + "ms");
                    }
                    else
                    {
                            conn = ds.getConnection();
                    }

                    return conn;
            }

So what you need to consider:

  1. support and activity (as is available noted)
  2. speed
  3. monitoring, logging, and production control

BoneCP looks fast (I've not heard about it before) but honestly C3P0 continues to be a lot more than fast for all of us too. When we examined a couple of four to five years back DBCP was horrifyingly slow (they have the symptoms of fixed that), Oracle's pool was fairly slow, and C3P0 was extremely fast. Our test looked greatly such as the one on BoneCP's site.

I'm not sure anything about BoneCP's manageability. #3 has switched to be the most crucial functionality inside a production atmosphere for all of us.

Whenever we were making our choice a few years back, it had been just between c3p0 and dbcp. In those days c3p0 was the one which could rebuild its connections after oracle restart. With DBCP we needed to restart the application server to have it running again.

Also I've found c3p0 debug hanging connections feature very helpful for monitoring connection leaks which may be otherwise very difficult to find.

Things I didn't have from c3p0 is helpful logging for performed claims with here is how lengthy they required.