Hello Thorsten,

-----Original Message-----
From: Thorsten Heit <heit_tom...@icloud.com.INVALID> 
Sent: Friday, August 8, 2025 2:55 PM
To: users@tomcat.apache.org
Subject: Re: How to access a REST service

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.

DGS: Please see my recent replies to Rob Sargent and others.  The Glassfish 
monitoring system seems to say that there currently are no leaks.

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?

DGS: Yes, everything is being closed.

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

DGS: I discussed this in my previous email to this list.  I don't think that 
approach will work in my situation.

DGS: Thanks for your replies.

DGS: Dan

Regards

Thorsten

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


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

Reply via email to