struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeromy Evans <>
Subject Re: about DAO
Date Mon, 03 Mar 2008 07:27:57 GMT
hns wrote:
> i have use ms access database
> i have set in that if user is valid then username and userid and
> connection object is stored in session
> now this connection object i have pulled in entire session to workout with
> common object
> is this good for security and performance?
> I little bit worry about it 

No, it's not good to store a connection object in the session.  Treat 
the connection as a scarce resource. If you hold a connection in a 
session the resource is wasted and you risk running out.

a. open a connection for each request and close it at the end of the 
request  *every time*; or
b. use a connection pool

The latter manages the connections for you, allocating you one when you 
need it, but managing them in a sensible way (eg. keeping the connection 
open but allocating them exclusively for request).

Connection Pooling for Microsoft Access:

With JDBC:

Via Tomcat:

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

View raw message