Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 9C1482E0042 for ; Mon, 18 Feb 2008 19:31:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 13856-03 for ; Mon, 18 Feb 2008 19:31:12 -0400 (AST) Received: from beaver.fastcrypt.com (beaver.fastcrypt.com [64.7.141.17]) by postgresql.org (Postfix) with ESMTP id 35A152E0040 for ; Mon, 18 Feb 2008 19:31:18 -0400 (AST) Received: from [192.168.1.14] (dcdsl.ebox.com [64.7.143.116]) by beaver.fastcrypt.com (Postfix) with ESMTP id 71C7C1580368; Mon, 18 Feb 2008 18:34:26 -0500 (EST) Cc: pgsql-jdbc@postgresql.org Message-Id: <90F06A2B-BCAD-4556-9CD6-7B05192AC9E6@fastcrypt.com> From: Dave Cramer To: Paul Tomblin In-Reply-To: <8efd35820802181148o3325551fj2f4f7de7baab39a1@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v919.2) Subject: Re: Getting "This ResultSet is closed" exceptions Date: Mon, 18 Feb 2008 18:31:16 -0500 References: <8efd35820802180619l352d9b0eta35788642a5fc4eb@mail.gmail.com> <3fccaa690802181051r377afa2an33fb9e1a3a7b65ca@mail.gmail.com> <8efd35820802181059x45bf1f0el712930cffa58ed6@mail.gmail.com> <3fccaa690802181110j4b5d1429ta8ea641f4ebb160@mail.gmail.com> <8efd35820802181148o3325551fj2f4f7de7baab39a1@mail.gmail.com> X-Mailer: Apple Mail (2.919.2) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/128 X-Sequence-Number: 18335 On 18-Feb-08, at 2:48 PM, Paul Tomblin wrote: > On Feb 18, 2008 2:10 PM, Andres Olarte > wrote: >> You might go for using a single connection per thread. Works for me. > > Forgive a possibly stupid question, but how would a class know whether > there is a Connection for this thread already? I use a simple static > to hold the Connection, and so I get one for the whole program. But > there is a lot of asynchronous stuff going on with GUI callbacks, > external "messages" and RMI calls, etc. Do I have to create and > destroy a connection in every callback, or use some sort of thread > pooling system? A previous engineer on this project had one subsystem > that was creating a new database connection every second, and then > closing it a few milliseconds later - that seems like madness to me. And it was/is madness. Yes you want pooling mechanism, and I don't think a single connection for the whole program is a good thing. Certainly if you have async callbacks it's very likely you are stomping on statements. Dave > > > > -- > For my assured failures and derelictions I ask pardon beforehand of my > betters and my equals in my Calling here assembled, praying that in > the hour of my temptations, weakness and weariness, the memory of this > my Obligation and of the company before whom it was entered into, may > return to me to aid, comfort and restrain. > > ---------------------------(end of > broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match