tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Morten <>
Subject Managing DB connections via HttpSessionListener
Date Mon, 17 Nov 2003 13:09:44 GMT

Hi. I have a setup where I cannot just use a DataSource with pooled
connections. The user logs in, performs some operations against a
database by giving a host, port and sid, and quits again.

I would prefer to not having to open/close the DB connection each time,
but as the DB is dynamically selected, I cannot predefine it in a pool

I've considered implementing the HttpSessionListener interface and close
the connection in the sessionDestroyed(..); method, would that work? I
suspect that it can be dangerous to keep the connection obect in the 
session as that may get serialized to disk, so I'd be storing a key
in the session that allows me to look up the connection and close it.

Any other suggestions on how to accomplish this sort of setup in a 
somewhat elegant manner?



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message