John Farrel wrote:However, it's possible to turn this functionality off by adding dontTrackOpenResources=true to the MySQL JDBC URL.
Instead of such hacks, I'd suggest to stick to best practices and explicitly close the
Statements and
ResultSets after use. Every (reasonable) JDBC tutorial says so.
You should call
close() on connections obtained from connection pool too, of course. This is the correct way to return the connection to the pool (mentioning it because it isn't entirely clear from your post whether you're doing so). Some connection pools might ensure that resources created on that connection which weren't properly closed are freed, but this depends on the particular connection pool you're using.