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: Sat, 13 Aug 2016 09:54:53 -0400 Organization: Aioe.org NNTP Server Lines: 29 Message-ID: References: <87shuakxjq.fsf@Equus.decebal.nl> <87k2fllkjf.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: 7bit 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:35303 On 8/13/2016 4:05 AM, Andreas Leitgeb wrote: > Marcel Mueller wrote: >> However, it might or might not be a good advice to intentionally keep a >> DB connection idle for an hour. > > I've seen too many firewalls shut off connections after an hour or > even earlier to leave the "might"-option uncontradicted. > > Well, it "might" be that somewhere else there is no such firewall, > but judging it as a piece of advice, I see no way it could possibly > be a good one. In general no. But in the cases where a single long lasting connection is a good idea, then maybe. The single long lasting connection is often an adhoc internal thing. For production with separate database server and firewall between app server and db server, then open/close and a connection pool is the norm. Note that a connection pool actually also tries to keep connections open, but it is usually configured to verify the connection before returning it and do a discard and connect again if necessary. Arne