Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix connection leak by releasing the obtained connection properly #120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rdlf0
Copy link

@rdlf0 rdlf0 commented Jan 31, 2023

This PR fixes a connection leak that happens when checking the driver version in order to determine if JDBC 4.2 APIs should be used or not by the Hibernate integrators.

The connection was obtained through obtainConnection(), but was not properly released, as invoking close() doesn't actually make the connection available in the connection pool. Calling releaseConnection() on the other side follows the correct process for releasing the resources and this way the connection pool stays balanced and there are no leaks. The closing of the connection is then handled by Hibernate.

A workaround for the existing connection leak is providing the jadira.usertype.useJdbc42Apis system property. Either value (true or false) will make the above check unnecessary and a connection will not be obtained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants