Re: where to close statement ?

Поиск
Список
Период
Сортировка
От Guillaume Rousse
Тема Re: where to close statement ?
Дата
Msg-id 00041822430000.02798@agathe
обсуждение исходный текст
Ответ на Re: where to close statement ?  (Joseph Shraibman <jks@p1.selectacast.net>)
Список pgsql-interfaces
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.


В списке pgsql-interfaces по дате отправления:

Предыдущее
От: Joseph Shraibman
Дата:
Сообщение: Re: where to close statement ?
Следующее
От: Joseph Shraibman
Дата:
Сообщение: Re: JDBC: Missing Classes?