Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id F0BA42E0042 for ; Mon, 18 Feb 2008 18:07:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 11423-01 for ; Mon, 18 Feb 2008 18:07:55 -0400 (AST) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.185]) by postgresql.org (Postfix) with ESMTP id 7B1D62E0035 for ; Mon, 18 Feb 2008 18:07:55 -0400 (AST) Received: by nf-out-0910.google.com with SMTP id f5so637111nfh.23 for ; Mon, 18 Feb 2008 14:07:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date:user-agent:cc:references:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:message-id:sender; bh=xlZnDlsk/iEvfeHsipaiy35SLwHm2COdijsisHZJsL4=; b=E4I4g0uXRMlRzv5epPD6tjf/QYnZoKzenIWK1vdMN6HLpsQ4UttkdHNpYe2VUs7CtHDBdB3UQXqZtkNEu8d7xREgTLpzs2d6freU1pzSBH+QaARW+bcfAs6IA1ld78UmeCdr5BWMTQgVFUsKjiEEomzjA+IutUlyeYuH2Fv7Wwk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:references:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:message-id:sender; b=jiC6jLjXJF5D36G07sZoWynMx8ffytFqzkCjD7cpjZJnJ9c4C/JgJ3mzLCX69oGgecYtv82/6xTtAGlKdlVMfi5VdzHbG/ts3xL4NjZfyjVz8PFAf6hefCI8d0qDOh+i1HdMtg+M+QzGyMfIeZ/DRMy1y+tN/VkZkFyCjr9yFpw= Received: by 10.151.149.14 with SMTP id b14mr2226347ybo.19.1203372472887; Mon, 18 Feb 2008 14:07:52 -0800 (PST) Received: from waterloo.local ( [99.234.98.167]) by mx.google.com with ESMTPS id q14sm7009507qbq.33.2008.02.18.14.07.51 (version=SSLv3 cipher=OTHER); Mon, 18 Feb 2008 14:07:52 -0800 (PST) From: Jan de Visser To: pgsql-jdbc@postgresql.org Subject: Re: Getting "This ResultSet is closed" exceptions Date: Mon, 18 Feb 2008 17:08:06 -0500 User-Agent: KMail/1.9.6 (enterprise 0.20080118.763038) Cc: "Paul Tomblin" References: <8efd35820802180619l352d9b0eta35788642a5fc4eb@mail.gmail.com> <3fccaa690802181110j4b5d1429ta8ea641f4ebb160@mail.gmail.com> <8efd35820802181148o3325551fj2f4f7de7baab39a1@mail.gmail.com> In-Reply-To: <8efd35820802181148o3325551fj2f4f7de7baab39a1@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200802181708.07111.jdevisser@digitalfairway.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/126 X-Sequence-Number: 18333 On Monday 18 February 2008 14:48:24 Paul Tomblin wrote: > Forgive a possibly stupid question, but how would a class know whether > there is a Connection for this thread already? =A0I use a simple static > to hold the Connection, and so I get one for the whole program. That sounds like a bad plan to me. You're going to interleave transactions= =20 etc. (You are using transactions, aren't you? :) Look into connection pools= =20 (apache has DBCP http://commons.apache.org/dbcp which is good), or otherwis= e=20 use a threadlocal that keeps a connection per thread around. > But=20 > there is a lot of asynchronous stuff going on with GUI callbacks, > external "messages" and RMI calls, etc. =A0Do I have to create and > destroy a connection in every callback, or use some sort of thread > pooling system? =A0A 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 Creative, but not very scalable :) jan =2D-=20 =2D------------------------------------------------------------- Jan de Visser =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 jdevisser@digitalfair= way.com =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Baruk Khazad! Khazad ai-menu! =2D-------------------------------------------------------------