JDBC Connection pooling using C3P0

后端 未结 4 1437
生来不讨喜
生来不讨喜 2020-12-23 21:04

Following is my helper class to get DB connection:

I\'ve used the C3P0 connection pooling as described here.

public class DBConnection {

    private         


        
4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-23 21:48

    With a pooled data source, the connections in the pool are not actually closed, they just get returned to the pool. However, when the application is shut down, those connections to the database should be properly and actually closed, which is where the final cleanup comes in.

    Incidentally, the c3p0 project is pretty much dead in the water, I recommend you use Apache Commons DBCP instead, it's still being maintained.

提交回复
热议问题