Is DBCP (Apache Commons Database Connection Pooling) still relevant?

前端 未结 4 475
Happy的楠姐
Happy的楠姐 2020-12-08 22:42

The JDBC 3.0 spec talks about Connection (and Prepared Statement) pooling.

We have several standalone Java programs (i.e. we are not using an application server) tha

4条回答
  •  旧巷少年郎
    2020-12-08 22:57

    DBCP has serious flaws. I don't think it's appropriate for a production application, especially when so many drivers support pooling in their DataSource natively.

    The straw that broke the camel's back, in my case, was when I found that the entire pool was locked the whole time a new connection attempt is made to the database. So, if something happens to your database that results in slow connections or timeouts, other threads are blocked when they try to return a connection to the pool—even though they are done using a database.

    Pools are meant to improve performance, not degrade it. DBCP is naive, complicated, and outdated.

提交回复
热议问题