----- Original Message -----
From: jon * <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 10, 1999 10:06 PM
Subject: Re: Session problems with Java Servlet Programming Book...
> > I was under the impression that
> > upon leaving my browser my session would automatically be invalidated
and
> > hence my database connection would be closed when valueUnbound was
called,
> > but its not being called. Do I need to override the session identifier's
> > expiry? Any ideas?
>
> Wrong. Sessions are expired by the servlet engine or when you close them.
> How does the servlet engine know that you have closed your browser?
>
> Also, why are you trying to store a database connection in a session? That
> is crazy. ;-) Use a connection pool instead. I have one implemented in
Dash
> that is quite cool cause it uses the Singleton methods to cache
> connections...
>
>
<http://www.working-dogs.com/dash/cvsweb/index.cgi/dash/com/workingdogs/dash
> /util/db>
>
> -jon
>
Hi Jon,
why is storing a database connection in a session crazy? You don't say why.
Jason Hunter seems to think it is good enough
to use as an example in his book. I use it to great effect in web apps.
It does have many advantages over connection pooling (simplicity is one
great one).
Error recovery when a connection breaks is simple too.
How many people are able to design and implement thread safe connection
pool objects? It is not a trivial exersise to do that and although there are
probably many good
systems available there are even more bad ones.
I use connection pooling for high demand environments with servlets and
singleton connections in JSP's
which I store in the Session Object. Both schemes are valid, especially if
your Database server is capable
of supplying the connections that you typically need.
Bemused
Andy Bailey
___________________________________________________________________________
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