Problem description:
To connect to the database for query on the page, the obtained results are displayed on the page. After each query, close is used to close the connection. Normally, it can be monitored in the database. After a connection is created, it will be released soon after the query is complete. However, when a query is complete, if you press F5 on the browser to refresh the page, the database connection will keep increasing, and the original connection is released slowly, and the database will soon be dragged to death.
Using the connection pool can only limit the total number of connections. If a person refresh quickly, the database will not die, but soon one will run out of resources and the application will be dragged to death,
Solution:
Do not create links in beans. They should be written in static methods of a class and passed as parameters so that each caller can use the same static link.
In the BEAN of the link, first check whether the static link is null. If not, directly reference the link. If yes, re-establish the link.