Understanding database connection pool

Mainly from https://blog.csdn.net/biubiubiulover/article/details/79853608  this article to learn, and then do a personal note: 

 Database thought connection pool is very simple, the database connection as an object is stored in a Vector object, once the database connection is established, different database access request can share these connections so that the connection with the established database by multiplexing, can overcome these shortcomings, greatly save system resources and time.

The main operation of the database connection pool as follows:
(1) establishment of a database connection pool object (server startup).
(2) creating an initial number of database connections (i.e.: number of idle connections) in accordance with the parameters specified in advance.
(3) a database access request, to obtain a direct connection from the connection pool. If the database connection pool is not idle connection object, and does not reach the maximum number of connections (ie: maximum number of active connections), create a new database connection.
(4) access to the database.
(5) close the database, all database connection is released (in this case close the database connection is not actually closed, but it is put into the free queue as actual idle connections is greater than the initial number of idle connections is a releasable connection)
(6) release database connection pool object (server stops, during maintenance, the release of the database connection pool object, and the release of all connections).
 

Then the problem are the following

1, can know whether the maximum number of connection pool?

2, if the maximum number of connections the connection pool to achieve, how to create a new connection?

3, connection pooling is when the release of the database connection? Operating codes needed? Or database connection pooling operation is completed can be determined automatically close the connection? 

Published 125 original articles · won praise 9 · views 30000 +

Guess you like

Origin blog.csdn.net/jiezhang656/article/details/105286006