I'll not copy the documentation, as the rules of the forum say not to. You may want to read them. They're quite good.
Basically, calling close will close the JDBC connection, which may or may not be appropriate for what you want to do. Disconnect is similar, but its behavior changes depending upon how the JDBC connection was created. I don't think you'd want to do close() unless you were really sure that you were done with whatever transactions you were performing.
I ask where the application runs out of memory because this is usually caused by an inappropriate fetching strategy. For example, if it typically runs out of memory performing a list() on a criteria, then perhaps too many records are being pulled into memory. If it fails after attempting to perform thousands of updates without intermittent flushes or commits, then perhaps the cache is growing too large. I know you say you don't perform any updates, only queries, but it 's just an example.
Oh, and have you checked the tomcat settings for memory. Perhaps it is using the default maximum heap size, which could be too small.
I don't think it is unreasonable to show at least some examples of where it fails (or at least where you think it fails) so we can look at what's going on. All you've basically told us is that you have 5 apps on tomcat which connects to multiple database types and it runs out of memory intermittently at times of high load. Hmm, do you think you could help troubleshoot something remotely given this information? Maybe I'm just not that good.
|