tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <>
Subject RE: [off topic] - passing a ResultSet from a servlet to a JSP
Date Tue, 29 Apr 2003 18:18:34 GMT


>4) Puts the ResultSet into the session
>5) Forwards to a JSP page
>soon as the dB connection is closed. So how can it be working? And more
>importantly, what's a better way of accomplishing this?

Don't send ResultSets around.  Instead, have the servlets loop through
the result set and create whatever object you need to hold the result
set's contents.  Then close and discard the result set (and statement,
and connection to the db, etc, all in a finally {} block or whatever to
ensure they execute blah blah blah).  

Instead of passing the resultset, pass this object.  You have more
control over its implementation, whether it's serializable, etc.  As you
noticed, the ResultSet interface is subject to different implementations
in different JDBC drivers (even drivers from the same vendor for the
same DB on different platforms).  This makes the ResultSet object a bad
candidate for a session attribute, because variable platform-dependent
behavior tends to occur.

Yoav Shapira
Millennium ChemInformatics

This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.

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

View raw message