RE: where to close statement ? - Mailing list pgsql-interfaces

From Peter Mount
Subject RE: where to close statement ?
Date
Msg-id 1B3D5E532D18D311861A00600865478C70C4C8@exchange1.nt.maidstone.gov.uk
Whole thread Raw
In response to where to close statement ?  (Guillaume Rousse <Guillaume.Rousse@univ-reunion.fr>)
List pgsql-interfaces
I wrap the closes within the finally() block because of this:

try {... code ...
} catch(SQLException e) {... handle exception here ...
} finally {try {    if(rs!=null) rs.close();    if(st!=null) st.close();} catch(SQLException e1) {}
}

Peter

-- 
Peter Mount
Enterprise Support
Maidstone Borough Council
Any views stated are my own, and not those of Maidstone Borough Council.



-----Original Message-----
From: Joseph Shraibman [mailto:jks@p1.selectacast.net]
Sent: Tuesday, April 18, 2000 7:28 PM
To: Peter Mount
Cc: 'Guillaume Rousse'; pgsql-interfaces@postgresql.org
Subject: Re: [INTERFACES] where to close statement ?


Peter Mount wrote:

> Ah, forgot that bit. I put them under finally as it always gets run,
> although you have to wrap them in a try{} win finally if the parent
> method doesn't throw SQLException.
>
> Peter
>

The problem with that is that close() itself can throw a SQLException so
you have to wrap it twice.



pgsql-interfaces by date:

Previous
From: Peter Mount
Date:
Subject: RE: psql & java
Next
From: Peter Mount
Date:
Subject: RE: JDBC: Missing Classes?