From: Guillaume Rousse <Guillaume.Rousse@univ-reunion.fr>
To: Joseph Shraibman <jks@p1.selectacast.net>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: where to close statement ?
Date: Tue, 18 Apr 2000 22:40:00 +0400
Message-ID: <00041822430000.02798@agathe> (raw)
In-Reply-To: <38FCA940.C3D36528@selectacast.net>
References: <1B3D5E532D18D311861A00600865478C70C4BD@exchange1.nt.maidstone.gov.uk>
<38FCA940.C3D36528@selectacast.net>
Le mar, 18 avr 2000, vous avez écrit :
> 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.
so we have either :
finally {
try {
if (conn!=null) conn.close();
} catch (SQLException ignore) {}
}
or eventually :
inally {
try {
conn.close();
} catch (Exception ignore) {}
}
The second also deals with NullPointerException
--
Guillaume Rousse
Iremia - Université de la Réunion
Sleep doesn't exists. Just lack of cafeine.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: Guillaume.Rousse@univ-reunion.fr, jks@p1.selectacast.net
Subject: Re: where to close statement ?
In-Reply-To: <00041822430000.02798@agathe>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox