Mukul Gandhi wrote:
>
> Hi Pradeep,
> u can store connection objects of a user in session objects(seems to be the
> normal thing which should be done in database related servlets).
It's of course one way but I wouldn't recommend it as a general solution.
The drawback is that you then allocate a connection to each user for the
length of the session, or at least for the length of a number of related
requests. This is a scalability problem, since with many sessions you
need a lot of connections.
In many cases it's better to use other object (Vectors, Hashtables,
custom classes) in the session to keep track of all changes during a
multi-request "transaction" and only get a connection (ideally from a
pool) when the user is ready to "commit". The session objects are then
used to modify the real database data and commit immediate, all within the
short time of processing one request, and the connection is dropped (or
better, returned to the pool).
There are many connection pool implementations available on the net.
One that I wrote is at
http://WebDevelopersJournal.com/columns/connection_pool.html
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
___________________________________________________________________________
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