开发者

Should I close a connection that came from a datasource?

开发者 https://www.devze.com 2023-02-04 14:19 出处:网络
When I do a dataSource.getConnection(), when I want the connection to be return to the pool (and not closed), does calling the close method return开发者_StackOverflow社区 the connection to the pool or

When I do a dataSource.getConnection(), when I want the connection to be return to the pool (and not closed), does calling the close method return开发者_StackOverflow社区 the connection to the pool or actually close it?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消