简体   繁体   English

数据库连接池和connection.close()

[英]Database connection pooling and connection.close()

In the scenario where a connection is got from a database pool(like Commons DBCP, etc) and when the connection is closed using connection.close(), how is the connection returned to the pool? 在从数据库池(例如Commons DBCP等)获得连接的情况下,以及使用connection.close()关闭连接时,如何将连接返回到池中?

Is there come callback method in connection object which is called on connection.close() which returns the connection back to the pool from which it originated? 连接对象中是否有回调方法,该方法在connection.close()上调用,该方法将连接返回到其发起的池中?

Usually the connection object you receive is a decorator of the original one and calling close simply returns it to the pool. 通常,您收到的连接对象是原始对象的装饰器,调用close只会将其返回到池中。 It does not close it. 它不会关闭它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM