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 13:06:45 -0000 (UTC) Organization: A noiseless patient Spider Lines: 34 Message-ID: References: <87a839um2q.fsf@munus.decebal.nl> <874lte1pdj.fsf@munus.decebal.nl> Reply-To: avl@logic.at Injection-Date: Sat, 12 Aug 2017 13:06:45 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="b17b58269513967be9f55d4ca24024d5"; logging-data="19041"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19KsuUCnAQTOx6QE0bLV2c4" User-Agent: slrn/1.0.2 (Linux) Cancel-Lock: sha1:HBIHB/BhwHUHG5NndTFwVJNMbSI= Xref: csiph.com comp.lang.java.programmer:37143 The exception's message alone might not even be enough for analysis: either make sure to also print the StackTrace, or add manual tracing info like as follows: (only for simple experiments like this; real code should just log the complete stacktrace, or there'd be the risk that the where-labels eventually bit-rot out of sync and turn to become actively misleading): String where; >>> try { where = "stmt.close"; >>> stmt.close(); where = "rs.next"; >>> resultSet.next(); where = "rs.close"; >>> resultSet.close(); >>> } catch (SQLException e) { errorMsg += e.getMessage() + "\n where=" + where + "\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.