How to use Java JDBC connection pool?

connection-pooling, java, jdbc

Solution

Another fine alternative is the Apache Database Connection Pool.

Instead of getting a connection using DriverManager, you'll use a JNDI naming service to get your connection out of the pool.

Be sure to close your resources - Connection, Statement, and ResultSet. If you don't, your pool will be quickly exhausted.

Problem

I want to use a JDBC connection pool. The most important factor is that it's easy-to-use and bug-free. What is suitable for me?

Original source

Related problems