Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Andreas Leitgeb Newsgroups: comp.lang.java.programmer Subject: Re: Not closing a SQL(ite3) connection Date: Sat, 12 Aug 2017 09:33:19 -0000 (UTC) Organization: A noiseless patient Spider Lines: 14 Message-ID: References: <87a839um2q.fsf@munus.decebal.nl> <874lte1pdj.fsf@munus.decebal.nl> Reply-To: avl@logic.at Injection-Date: Sat, 12 Aug 2017 09:33:19 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="b17b58269513967be9f55d4ca24024d5"; logging-data="1662"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18VEYXL6oAs0E3GbP7KYw0l" User-Agent: slrn/1.0.2 (Linux) Cancel-Lock: sha1:NclhZCtgCCmE2AZO2NSFigMc1Uc= Xref: csiph.com comp.lang.java.programmer:37141 >> try { >> stmt.close(); >> resultSet.next(); >> resultSet.close(); >> } catch (SQLException e) { >> errorMsg += "Could not close ResultSet.\n"; >> System.out.println(errorMsg); >> } Also, it might be better to actually add the exception information rather than a hardcoded string to errorMsg. Unless you really ran it in the debugger and examined e, you wouldn't know, what really threw the exception.