Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 99011 invoked from network); 3 Feb 2009 16:18:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Feb 2009 16:18:51 -0000 Received: (qmail 88391 invoked by uid 500); 3 Feb 2009 16:18:50 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 88226 invoked by uid 500); 3 Feb 2009 16:18:49 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 88217 invoked by uid 99); 3 Feb 2009 16:18:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Feb 2009 08:18:49 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [66.207.132.3] (HELO web2.nidhog.com) (66.207.132.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Feb 2009 16:18:41 +0000 Received: from win2000 (filardo.vdsl.nidhog.net [66.207.132.80]) (authenticated bits=0) by web2.nidhog.com (8.14.3/8.13.8) with ESMTP id n13FpJR3036166; Tue, 3 Feb 2009 10:51:22 -0500 (EST) (envelope-from john@johntdow.com) Message-Id: <200902031551.n13FpJR3036166@web2.nidhog.com> From: "John T. Dow" To: "Derby Discussion" , "Knut Anders Hatlen" Date: Tue, 03 Feb 2009 10:38:21 -0500 Priority: Normal X-Mailer: PMMail 2000 Professional (2.20.2717) For Windows 2000 (5.0.2195;4) In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Subject: Re: Can an embedded Derby connection support multiple simultaneous result sets? X-Nidhog-MailScanner-Information: Please contact the ISP for more information X-Nidhog-MailScanner: Found to be clean X-Nidhog-MailScanner-From: john@johntdow.com X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No On Tue, 03 Feb 2009 11:48:58 +0100, Knut Anders Hatlen wrote: >>>>"John T. Dow" writes: >>> >>> For example, after calling rs2.next(), rs1.getRow() returns 0. >>> >>> However, the resultset is positioned properly because >>> rs1.getString("colname") returns the correct value. > >Looks like I missed that last sentence when I answered your mail the >first time. I still think that rs1 is not positioned on a row, and >that's why rs1.getRow() returns null. The difference between getRow() >and getString() is that the ResultSet object has a copy of the current >row from which getString() fetches the string value, and it's not >affected by the fact that the underlying cursor has lost its >position. The row number, on the other hand, is not cached in the >ResultSet, so getRow() always fetches the row number from the cursor and >therefore detects that there's no current row. > >-- >Knut Anders You are correct, I was using autocommit and when it's turned off, getRow() continues to report the row properly. PostgreSQL returns the correct row even with autocommit on. That's a bummer. I'm not about to rewrite lots of code so the standard mode is autocommit off. Most of the time having it on is nice, it's the exception that I want it off. I was relying on getting a 0 to indicate that the result set is empty. (After opening, I move to the first row by default so getting a 0 has been a reliable indicator of an empty result set.) I sure wish there was an isEmpty() method for result sets. I need a database-agnostic technique for determining if a result set is empty. Perhaps do next() and then previous(), with appropriate tests for being at the beginning or end initially. (I always use scrollable result sets.) John