Why is this technology needed?
Database connection is a very precious and limited resource, especially in multi-user network, the management of database directly affects the performance of the whole system.
The establishment of a database connection is a very time-consuming operation, in the page application if each user needs to create a database connection, the response time will be very long, will affect the user experience
Second, the database connection number is limited, if the management is not good users often establish a connection with the database and forget to release, then run for a long time, the database connection resources will be exhausted, when there are new user actions will wait until the resources are released, which has an impact on the availability of the system. Therefore, it is very important to manage database connection resources, especially the Web application system.
How database connection pooling works
The database connection pool is responsible for allocating, managing, and freeing the database connection, which allows you to reuse only one existing database connection instead of creating a new database connection, and it is also responsible for freeing up database connections that are longer than the maximum idle time and avoiding omissions due to lack of database connectivity.
In Java EE, the server starts up with a certain number of pooled connections and maintains not less than this number of connections, when the user needs a database connection first using pooled connections (free pooled connections) instead of creating a new database connection and marking it as busy. When the user finishes using the database connection, the current connection is freed and marked as a spatial connection. If there is no idle connection, the server will create a new database connection according to the configuration of the parameters, which will greatly improve the response time of the system and improve the operation efficiency. On the other hand, for improved operational performance, database connectivity frees up database connections that are currently idle for more than the maximum idle time, avoiding omissions that do not release database connections.
How database connection pooling works and how this technology is generated