ResultSets can and should be closed. They are not like normal classes with
an iterator.

ResultSets are created by Statements. Statements can and should be closed.
When a statement is reused, it will close the resultset (if not closed
already) that it previously supplied in order to get the new results. When a
statement is closed it will close the resultset it created. The number of
simultaneous open statements for a given connection can be (and is)
limited - the oracle limit is about 50 by default.

Statements are created by Connections. If you close the connection it closes
the statement which closes the resultset.

Regards,
Paul


-----Original Message-----
From: Zenon Braga F. [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 20, 2001 9:49 AM
To: [EMAIL PROTECTED]
Subject: Re: Closing ResultSet and Statement?


        I'm not sure, but I think that you don't close a ResultSet, you only close
the connection, in fact, you can even close the connection and still work
with your ResultSet.
        Think of ResultSet like a normal class with an interator that allows you to
go forward and backward.

sincerely,

Zenon Farias Braga F.


>From: "Mick Sullivan" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Subject: Closing ResultSet and Statement?
>Date: Mon, 19 Mar 2001 20:48:31 -0000
>
>Hi
>Does anyone know how to close a ResultSet?
>Heres my code:
>public String getName() throws Exception {
>               Statement statement = connection.createStatement();
>               int myInt = 1;
>               ResultSet rs = statement.executeQuery("SELECT Name"+
>               " FROM nameAddress" +
>               " WHERE ID = ("+
>               myInt + ")");
>                       rs.next();
>                       String myString = rs.getString("Name");
>                 //change the resultSet to a string
>                 //so it can be used by the jsp page
>               return myString;
>      }
>Any help at all would be much appreciated
>Thanks in advance,
>Mick
>
>
>
>_________________________________________________________________________
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


Reply via email to