Hi Daniel,

You are correct, I only catch SQL exceptions.  I have modified my code so that 
the Connection object will be closed if an SQL exception is thrown, but I 
wasn’t aware that there are other types of exceptions that I should look for.  
I will look into this.

However, I don’t think that this is causing a memory link, since my code has 
always run perfectly without throwing any exceptions at all, as far as I know.

Have a look again at your code. You insist of not having a memory leak, but as already mentioned several times in this thread you're not correctly closing objects, especially in case of an exception.

In the code snippet you presented you only tried to close the connection object itself, but what about other JDBC objects created/used in your code? What about (prepared) statements, result object instances etc.? Do you also close them?

Please do yourself a favor and use try-with-resources for all classes that implement AutoCloseable. This makes life much easier.



Regards

Thorsten

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to