Path: csiph.com!aioe.org!.POSTED!not-for-mail From: =?UTF-8?Q?Arne_Vajh=c3=b8j?= Newsgroups: comp.lang.java.programmer Subject: Re: Not closing connections and statements Date: Fri, 12 Aug 2016 09:39:35 -0400 Organization: Aioe.org NNTP Server Lines: 19 Message-ID: References: <87shuakxjq.fsf@Equus.decebal.nl> NNTP-Posting-Host: 7SK6yTFfqwlIPNBLl3l7Qg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.java.programmer:35272 On 8/12/2016 9:15 AM, Arne Vajhøj wrote: > Not closing statements is not so bad. I believe that somewhere > in the JDBC spec it promise that all statements associated with > a connection get closed when the connection is closed. > > I still recommend closing statements though. Just in case > the JDBC driver implementor forgot this little quirk. From the JDBC 4.2 specs: 9.6.4.1 Connection.close An application calls the method Connection.close() to indicate that it has finished using a connection. All Statement objects created from a given Connection object will be closed when the close method for the Connection object is called. Arne