Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 24542 invoked from network); 22 Feb 2006 20:20:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Feb 2006 20:20:42 -0000 Received: (qmail 51320 invoked by uid 500); 22 Feb 2006 20:20:24 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 51296 invoked by uid 500); 22 Feb 2006 20:20:24 -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 51285 invoked by uid 99); 22 Feb 2006 20:20:23 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Feb 2006 12:20:23 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [192.18.98.34] (HELO brmea-mail-3.sun.com) (192.18.98.34) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Feb 2006 12:20:23 -0800 Received: from phys-epost-1 ([129.159.136.14]) by brmea-mail-3.sun.com (8.12.10/8.12.9) with ESMTP id k1MKK1Qj002251 for ; Wed, 22 Feb 2006 13:20:02 -0700 (MST) Received: from conversion-daemon.epost-mail1.sweden.sun.com by epost-mail1.sweden.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) id <0IV300C01UGIUU@epost-mail1.sweden.sun.com> (original mail from Bernt.Johnsen@Sun.COM) for derby-user@db.apache.org; Wed, 22 Feb 2006 21:20:01 +0100 (MET) Received: from localhost (vpn-129-159-115-216.Norway.Sun.COM [129.159.115.216]) by epost-mail1.sweden.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) with ESMTP id <0IV300IFRV5CBZ@epost-mail1.sweden.sun.com>; Wed, 22 Feb 2006 21:20:01 +0100 (MET) Date: Wed, 22 Feb 2006 21:20:00 +0100 From: "Bernt M. Johnsen" Subject: Re: ResultSet.getInt() In-reply-to: <43FCC067.6010103@network-inventory.de> To: Derby Discussion , thomas.vatter@network-inventory.de Message-id: <20060222202000.GA15031@localhost.localdomain> Organization: Sun Microsystems MIME-version: 1.0 Content-type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary=1yeeQ81UyVL57Vl7 Content-disposition: inline User-Agent: Mutt/1.5.9i References: <43FCC067.6010103@network-inventory.de> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --1yeeQ81UyVL57Vl7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable I think your answer lies in the description of wasNull() boolean wasNull() throws SQLException Reports whether the last column read had a value of SQL NULL. Note that you must first call one of the getter methods on a column to try to read its value and then call the method wasNull to see if the value read was SQL NULL. You have not called RS.getXXX() and thus the excpetion is correct. >>>>>>>>>>>> Thomas Vatter wrote (2006-02-22 20:49:59): >=20 > I have a problem using ResultSet.getInt() method, each call returns an=20 > exception: > org.apache.derby.client.am.SqlException: Invalid operation: > wasNull() called with no data retrieved > at org.apache.derby.client.am.ResultSet.wasNull(Unknown Source) >=20 > The code is > ResultSetMetaData RSMD =3D RS.getMetaData(); > int INTcols =3D RSMD.getColumnCount(); > String STRtemp =3D null; > while(RS.next()) > { > String STRvalue =3D new String(); =20 > for(int INTcol =3D 1; INTcol <=3D INTcols; INTcol++) > { > int INTdummy =3D RSMD.getColumnType(INTcol); = =20 > switch((int)RSMD.getColumnType(INTcol)) > { > if(!RS.wasNull()) // raises exception > =20 > { = =20 >=20 > STRvalue =3D "" +=20 > RSaktuelles.getInt(INTcol); = =20 > }=20 > ... > } > } > } >=20 > what can I do to avoid this exception >=20 > tom >=20 --=20 Bernt Marius Johnsen, Database Technology Group,=20 Staff Engineer, Technical Lead Derby/Java DB Sun Microsystems, Trondheim, Norway --1yeeQ81UyVL57Vl7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFD/MdwlFBD9TXBAPARArY5AKDDgEIpCXcgd1Y1OJJiL/IwacZj0QCgoPN/ 1t38x7N9g0FCyoGbW29sT2s= =8BS7 -----END PGP SIGNATURE----- --1yeeQ81UyVL57Vl7--