----- Original Message -----
From: "Brad Cox" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>

> I've been storing JDBC connections from the connection pool in a named
> session attribute under the assumption that they would be automatically
> returned to the pool when the session expires. But on examining the code
it
> now seems that they are just closed and deleted, thus draining the
> connection pool.

This is not a good thing to do. You should use a connection pool object
which is basically a store of all your database connections. You check out a
connection from there and when you are done with using it, you return it to
the pool.
You can find it detailed at the link
http://wackyhtml.com/columns/connection_pool.html


> Handling this manually when users log off explicitly is no problem. But
how
> do I know when users just wander away? E.g. is there a way to be notified
> when sessions expire?

Have a look at the javadocs for the interface
javax.servlet.http.HttpSessionBindingListener
This is what you need if you want to be notified of a session which expires.

> How do others ensure that connections get returned to the pool?

Most people use connection pools.
This topic keeps coming up on the list and you can find loads of information
on this in the archives of the list.

Regds,
Gokul

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to