JDBC Statement leaks after exceptions other than SQLException during insert/update/...
Description
See
Essentially, it seems we release batched statements after a certain type of exception happens during an insert/update/etc., but for some strange reason we only do that for SQLException, and sometimes JDBC exception. See for example this:
As a result, any other exception (such as StaleStateException) will lead to batched statements not being released: that’s a leak, and while Agroal for example will catch that and release the statement, it will also log pesky warnings. It would be better to release statements correctly ourselves.
See
Essentially, it seems we release batched statements after a certain type of exception happens during an insert/update/etc., but for some strange reason we only do that for SQLException, and sometimes JDBC exception. See for example this:
As a result, any other exception (such as StaleStateException) will lead to batched statements not being released: that’s a leak, and while Agroal for example will catch that and release the statement, it will also log pesky warnings. It would be better to release statements correctly ourselves.