C
Clive Backham
I'm in the early stages of experimenting with JSP talking to
databases. (I'm not sure if this is the correct newsgroup for
questions on this subject. If not, could someone suggest a better
group to try?)
All the examples I've come across so far show a database connection
being made, used, and closed in a single page. In the course of my
experiments, I've determined that the database connection can be saved
as a session attribute and remains available to other pages in the
application without the need to re-establish the database connection
on each page. This clearly has some performance advantages.
The question is: is this regarded as acceptable? Obviously I can close
the connection if the user of the web application explicitly issues a
logout of some sort. But what if they just leave the website? Is it OK
to rely on the garbage collector to close the database connection when
the session itself gets timed out?
databases. (I'm not sure if this is the correct newsgroup for
questions on this subject. If not, could someone suggest a better
group to try?)
All the examples I've come across so far show a database connection
being made, used, and closed in a single page. In the course of my
experiments, I've determined that the database connection can be saved
as a session attribute and remains available to other pages in the
application without the need to re-establish the database connection
on each page. This clearly has some performance advantages.
The question is: is this regarded as acceptable? Obviously I can close
the connection if the user of the web application explicitly issues a
logout of some sort. But what if they just leave the website? Is it OK
to rely on the garbage collector to close the database connection when
the session itself gets timed out?