Use connection pooling.  This way you don't really have a connection open for
each client but you get an already open connection for each request.

dave.

Joe Lei wrote:

> Thanks for all the prompt response.
>
> My current implementation relies either on explicit user logoff (which
> trigger the servlet to invalidated a session object) or session expiry (say
> 30mins) and subsequently invoke the unbound fct of the listener interface to
> close the db connection (one session object -to- one db session).
>
> But i expect, one more step forward, to invalidate the session as long as
> the browser closed or page navigated away (user navigate to other website)
> from my application.
>
> I found JavaScript doesn't have event like window -> onclose which allow me
> to insert code to trigger the servlet.   i did understand it's a bit
> demanding, but i really want to disconnect from db at the moment the user
> exits otherwise, an accumulated number of inactive connections may found on
> the DBMS in a timeout (30mins) window.
>
> Pls suggest
> Joe
> ----- Original Message -----
> From: Jim Richards <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, November 17, 1999 1:59 PM
> Subject: Re: [How to know a brower closed]
>
> > >I also have same question. Also i would like to know what are the ways to
> > >find out in my Servlet "whether the user is still available or not
> whether he
> > >has closed the browser/ cancelled the request by pressing the "ESC" key /
> shut
> > >down his browser / or he has got disconnected".
> >
> > There is no concept of a browser closing. Since all http sessions are
> stateless,
> > then each time a page is requested then when the browser finishes loading
> the
> > page or not, it is the end of the http session.
> >
> > Unless you check with the server how much of the content has been sent
> there
> > is no real way to catch this.
> >
> > If what you really want is to know if the user is no longer browsing your
> site
> > then the timeout of a session can be captured with with the interface
> > HttpSessionBindingListener, which get called when the session times
> > out (so, say after 30 minutes of inactivity)
> >
> > An alternative (but more hassle, and a pain for the user) is to either use
> the
> > <body onunload=""> or to write an applet that sends a UDP packet when the
> > close method is called (although you then have a delay when the page load
> > and the UPD packet may not get through) ...
> >
> >
> > --
> > Subvert the dominant paradigm
> >  http://www.cyber4.org/members/grumpy/index.html
> >
> >
> ___________________________________________________________________________
> > 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
>
> ___________________________________________________________________________
> 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

--
David Mossakowski              [EMAIL PROTECTED]
Programmer                           212.310.7275
Instinet Corporation

"I don't sit idly by, I'm planning a big surprise"

___________________________________________________________________________
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