Closing a ResultSet object
From: Joshua (mark.dundon_at_mail.com)
Date: 09/29/04
- Next message: ras_nas: "Re: Add a program to IE's right click mouse menu?"
- Previous message: Michael Borgwardt: "Re: About Heavy Weight Component"
- Next in thread: Niels Dybdahl: "Re: Closing a ResultSet object"
- Reply: Niels Dybdahl: "Re: Closing a ResultSet object"
- Reply: Peter Kirk: "Re: Closing a ResultSet object"
- Reply: Sudsy: "Re: Closing a ResultSet object"
- Reply: Jared MacDonald: "Re: Closing a ResultSet object"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 29 Sep 2004 01:47:26 -0700
I have a database utility class with a number of static methods that
perform SQL actions. Amongst the paramaters passed to a static method
is a connection object. The database utility static method creates a
statement from the connection object that is passed in, performs an
SQL query on that statement, and returns a ResultSet. Originally this
utility method was calling the close() method on the statement object
for tidyness. Then I realised the ResultSet object was consequently
closed and therefore could not be used outside of the utility method.
The first question I have is if I call the close() method of the
ResultSet object will it close the statement object created in the
utility method?
Java docs suggests so -
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/ResultSet.html#close()
.
If this is the case then I will call ResultSet.close() in the method
calling the utility method after it has done it's job with the
returned data.
The second question I have is I'm wondering how others have best
designed a database utility class, and if I can maybe improve my
design.
- Next message: ras_nas: "Re: Add a program to IE's right click mouse menu?"
- Previous message: Michael Borgwardt: "Re: About Heavy Weight Component"
- Next in thread: Niels Dybdahl: "Re: Closing a ResultSet object"
- Reply: Niels Dybdahl: "Re: Closing a ResultSet object"
- Reply: Peter Kirk: "Re: Closing a ResultSet object"
- Reply: Sudsy: "Re: Closing a ResultSet object"
- Reply: Jared MacDonald: "Re: Closing a ResultSet object"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]