I forgot to mention: jboss 2.4.0, Oracle 8.1.7, Type 4 JDBC driver, Win NT4 SP6.
This is the purpose of connection pools, the underlying connections stay areound and a reused between method calls. This give much greater performance as opening connections takes a lot of time.
What you can do tho to reduce the length of time the connections are held for is to enable the idle timeout on the datasource and set the timout to a value suitable for your application.
The documentation can be found at http://www.jboss.org/documentation/HTML/ch04s07.html .
The properties you need to set are 'IdleTimeoutEnabled' and 'IdleTimeout'.
Thank you for the reply, but I guess I didn't make myself clear. I understand the point about connection pools and I didn't expect the connection object to go away. The problem is that the Oracle server is showing the connections open even after the stateless session bean is history. After a few runs, I am out of connections in the pool and the bean fails.
I have reduced the time between garbage collections to get around this problem, but it seems there should be a way to force the connections to close immediately. Thanks for the help.
I just read your answer again and maybe I am still misunderstanding the purpose of the pool. If the connections are supposed to stay open, then maybe the problem is that jboss isn't reusing them properly. The session bean should not fail for lack of available connections if there are 100 of them.
Are you closing the connections before you exit each method call. For any type of bean you should get a new connection from the pool and then close the connection (and any result sets and statements) before you exit from the method.
Duh, I looked at my entity beans again and they close connection only in unsetEntityContext(). Your explanation makes sense to me suddenly.
Did you get your problem fixed?
I saw the similar problem with my stateless session bean.