How to establish a connection pool in JDBC?

前端 未结 13 2545
一个人的身影
一个人的身影 2020-11-22 02:43

Can anybody provide examples or links on how to establish a JDBC connection pool?

From searching google I see many different ways of doing this and it is rather conf

13条回答
  •  迷失自我
    2020-11-22 03:09

    As answered by others, you will probably be happy with Apache Dbcp or c3p0. Both are popular, and work fine.

    Regarding your doubt

    Doesn't javax.sql or java.sql have pooled connection implementations? Why wouldn't it be best to use these?

    They don't provide implementations, rather interfaces and some support classes, only revelant to the programmers that implement third party libraries (pools or drivers). Normally you don't even look at that. Your code should deal with the connections from your pool just as they were "plain" connections, in a transparent way.

提交回复
热议问题