I think you cannot know when the client browser closes.
there are 2 options
- use connection pooling and return the connection to the pool after each request. I think that's the prefered method, but if you really need one dedicated connection per user, it's not really possible.
- Wrap your database connection in another object that implements the HttpSessionListener interface and put this object in your session. when the user logs out or when the session times out (15 or 30 minutes inactivity), an event is triggered where you can close the connection.
 
I would recommend the second option anyway in case you forget to close a connection when you use the first option.
 
Geert 'Darling' Van Damme
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of ªL§Ó®p
Sent: vrijdag 29 oktober 1999 4:52
To: [EMAIL PROTECTED]
Subject: Disconnect from a db when client browser closes

Hi, gurus:
 
I use a dbBean in a jsp page to handle all database requests
from that jsp page.
 
Does any one know how to call my close() method in the
dbBean when the client browser closes? Is there an triggered
evnt that can tell me ?
 
Any suggestion will be greatly appreciated.
 
--Jeff
 
-----------------------------------------------
Jeffrey Lin ([EMAIL PROTECTED])
R&D Division
Syscom Computer Engineering
-----------------------------------------------

Reply via email to