Always close or rollback connection to avoid possible leak #108
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@rbygrave This is a part of #107 and it would be great, if this can get merged soon.
what have we done here:
in #107 I've added a mode
CloseWithinTxn.FAILthat complains, if you callclosewithout a previous commit or rollback.The ConnectionPool behaves in this mode very similar as the DB2JCC driver. The driver does not allow
closewithin an UOW (UnitOfWork, =Transaction).As reported in #107, a
getSchema()can cause to start a UOW. so just atry-with-resourceswill not work any longer.In this PR, I added commits or rollbacks in the tests, so that it will follow the JDBC spec: https://docs.oracle.com/javase/8/docs/api/java/sql/Connection.html#close--
I discovered the following behaviours:
close()will throw an ERRORCODE=-4471, SQLSTATE=null