简体   繁体   中英

use jpa hibernate high concurrency will unable to acquire JDBC Connection

When I encounter high concurrency during jpa hibernate, the project will report “Unable to acquire JDBC Connection” error after running for a while But after I added the hikari database connection pool, the problem is solved. Why is this happening or there is no other way to solve it?

It depends on what pool you used before.

The HikariCP-maxLifeTime default is 30 Minutes. After this, the connection will be given back to the DBMS, which normally limits the maximum number of connections.

DBCP default is without limit.

If you did not use a pool, nobody closes the connections if you don't do it yourself.

So that might be the cause, why you don't get the exceptions anymore. But be aware, that a memory-leak might be left. That means there might be hibernate-sessions stored anywhere in your code, which never get used and never get closed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM