Connection Pool Exception

I’m using Openfire and editing for customizing my server.
But I faced a critical problem about an Exception.

I’m using MariaDB with my Openfire Server. And When I use my server long time, The active connection pool become 25 and the console said like this
"
java.sql.SQLException: ConnectionManager.getConnection() failed to obtain a connection after 11 retries. The exception from the last attempt is as follows: java.sql.SQLException: Cannot get a connection, pool error Timeout waiting for idle object
"
I added more code about accessing database and I closed my resources(ex: rs, pstmt, con etc…) but It still keep connection active fully.
I thought when I close my resources, The connection will be return back active connection to available but It wasn’t
How can I fix it?

I changed max connection 25 → 100 but It fully became active connection pool to 100

As you expected, when you close the resources (notably, the connection) that you obtained through DbConnectionManager, that will be put back in the pool.

If you’re exhausting the pool, then this probably means that you either have a lot of concurrent queries running, or that there’s some piece of prorietary code that doesn’t close the resources after usage.

Thank you for helping me!
Finally I caught my error u meant. I covered all opening DB Connection via try catch finally.
I wasted some resources bc of this!