开发者

[Java]Do we need connection pool if we only use 1 connection?

开发者 https://www.devze.com 2023-02-11 05:28 出处:网络
I would like to ask, if I am going to use a single connection in the whole program, do I need to use a connection pool? Does using a connection pool give me better performance?

I would like to ask, if I am going to use a single connection in the whole program, do I need to use a connection pool? Does using a connection pool give me better performance? For example, I may open a static connection and use it for multiple sql query, then fina开发者_运维知识库lly when the program finish, I close the connection. Most of the program I am dealing with, are not multi-threaded, so I don't see the benefit of using connection pool in such situation. Would anyone can answer my question, thank you.

Thanks in advance.


For example, I may open a static connection and use it for multiple sql query, then finally when the program finish, I close the connection. Most of the program I am dealing with, are not multi-threaded

Sounds like you don't need a connection pool.


You don't ever need a connection pool.

It can be useful if you require enforcement on having a limit number of connections.

0

精彩评论

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