tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Morten <li...@kikobu.com>
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
configuration.

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?

Br,

Morten




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message