Re: What happens to a ResultSet when statement closed

From: Andrew Rawnsley <ronz(at)ravensfield(dot)com>
To: Warren Little <wlittle(at)securitylending(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: What happens to a ResultSet when statement closed
Date: 2004-01-12 22:29:23
Message-ID: C5C641AA-454E-11D8-BF17-000393A47FCC@ravensfield.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


A ResultSet is tied to the statement. The result set is closed when the
statement is.

From the statement code:

public void close() throws SQLException
{
// Force the ResultSet to close
java.sql.ResultSet rs = getResultSet();
if (rs != null)
rs.close();

deallocateQuery();

// Disasociate it from us (For Garbage Collection)
result = null;
}

On Jan 12, 2004, at 5:11 PM, Warren Little wrote:

> Consider the following code
> ....
> ResultSet r = statement.executeQuery();
> statement.close();
> connection.close();
>
> What happens to the ResultSet r?
> What happens if I only close the statement, but continue to use
> the connection?
>
> --
> Warren Little
> Senior Vice President
> Secondary Marketing
> Security Lending Wholesale, LC
> www.securitylending.com
> Tel: 866-369-7763
> Fax: 866-849-8082
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>
--------------------

Andrew Rawnsley
President
The Ravensfield Digital Resource Group, Ltd.
(740) 587-0114
www.ravensfield.com

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2004-01-12 22:44:33 Re: PreparedStatement parameters and mutable objects
Previous Message Kris Jurka 2004-01-12 22:21:54 Re: What happens to a ResultSet when statement closed