Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / January 2005

Tip: Looking for answers? Try searching our database.

ResultSet processing/closure in JSP

Thread view: 
Simon - 11 Jan 2005 23:11 GMT
Hi,

I am trying to understand the implications of processing a ResultSet
in a JSP given that the ResultSet is created in a servlet, and then
placed in the request to provide access to the JSP.
 
My confusion is how the closure of the ResultSet is managed.  I am
aware that the standard procedure would be to open a connection,
execute a statement, and then process the results, before closing the
connection, statement, and result set in the servlet code.  As the
ResultSet object is required by the JSP where should I handle closing
it?  It seems very messy to create the ResultSet in the servlet, and
then close it in the JSP.

Any thoughts/suggestions are much appreciated.

Thanks,
Simon
Joe Weinstein - 12 Jan 2005 01:42 GMT
> Hi,
>
[quoted text clipped - 14 lines]
> Thanks,
> Simon

Hi. You should ideally close result sets asap, then close statements asap,
and lastly but most importantly, you should close connections without fail,
asap. By JDBC spec though, re-executing or closing the statement will
automatically close any outstandling result set from the statement, and
closing any connection will automatically close any outstanding statement
it produced, so that cascades all the way down.
Joe Weinstein at BEA
numen - 28 Jan 2005 10:32 GMT
one thing that i use it that i create two methods one to open the
connection an on to close.
now from my jsp i call the open method using an object of same class do th
processing and then call the closing method.
allthough i don't know whether it is correct to do or not

On Tue, 11 Jan 2005 15:11:07

> Hi,
>
[quoted text clipped - 14 lines]
> Thanks,
> Simon


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.