B
B
beduin012017-02-02 10:10:09
Database
beduin01, 2017-02-02 10:10:09

What is a database connection pool?

What is a database connection pool? For example, I have a class for working with a database. I just can't figure out whether it's worth moving the creation of a new connection into a separate method or pushing it into a constructor?
It's just that the class is part of the server code and it will be constantly accessed from the site, but it's not clear whether new connections will be created, if so, at what point?
And do they need to be closed explicitly?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
tex0, 2017-02-02
@tex0

What is a database connection pool?

Read here

M
Maxim Grekhov, 2017-02-09
@Sterk

In .net, the connection pool is implicitly implemented. When you call new XxxConnection(Sql,MySql, etc.) the connection is either created if there are no free ones or taken from the pool. Therefore, it is probably worth creating a connection every time it is needed and wrapping it in a using construct.
Here is the link on msdn

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question