简体   繁体   中英

Should I close a connection that came from a datasource?

当我执行dataSource.getConnection()时,当我希望连接返回池(而不是关闭)时,调用close方法是否返回到池的连接或实际关闭它?

When you call the close() on connection returned by a DataSource, it would return that to the pool to be used by other thread. Closing the connection defeats the purpose of the pool.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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