RE: where to close statement ?
От | Peter Mount |
---|---|
Тема | RE: where to close statement ? |
Дата | |
Msg-id | 1B3D5E532D18D311861A00600865478C70C4C8@exchange1.nt.maidstone.gov.uk обсуждение исходный текст |
Ответ на | where to close statement ? (Guillaume Rousse <Guillaume.Rousse@univ-reunion.fr>) |
Список | 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 по дате отправления: