Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id EF4076334B8 for ; Mon, 1 Feb 2010 16:39:47 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 65119-07 for ; Mon, 1 Feb 2010 20:39:33 +0000 (UTC) X-Greylist: delayed 01:20:28.786757 by SQLgrey-1.7.6 Received: from mail-ew0-f222.google.com (mail-ew0-f222.google.com [209.85.219.222]) by mail.postgresql.org (Postfix) with ESMTP id 0F8526332A3 for ; Mon, 1 Feb 2010 16:39:36 -0400 (AST) Received: by ewy22 with SMTP id 22so43080ewy.34 for ; Mon, 01 Feb 2010 12:39:35 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.91.20 with SMTP id g20mr2783964wef.94.1265056775359; Mon, 01 Feb 2010 12:39:35 -0800 (PST) In-Reply-To: References: <2f8a6c901002011053w4ec6425bodb502c67d4e2b2dc@mail.gmail.com> From: Nedim Cholich Date: Mon, 1 Feb 2010 15:39:15 -0500 Message-ID: <2f8a6c901002011239r40e7cdd4k66321122e12829a6@mail.gmail.com> Subject: Re: Jdbc4ResultSet getClob and getBlob are calling getLong internally To: Kris Jurka Cc: pgsql-jdbc@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.443 tagged_above=-10 required=5 tests=BAYES_00=-2.599, SUBJECT_FUZZY_TION=0.156 X-Spam-Level: X-Archive-Number: 201002/3 X-Sequence-Number: 20290 On Mon, Feb 1, 2010 at 15:15, Kris Jurka wrote: > On Mon, 1 Feb 2010, Nedim Cholich wrote: >> After getting 'org.postgresql.util.PSQLException: Bad value for type >> long' I found these two methods in Jdbc4ResultSet: >> >> =A0 public java.sql.Clob getClob(int i) throws SQLException >> =A0 { >> =A0 =A0 =A0 return new Jdbc4Clob(connection, getLong(i)); >> =A0 } >> >> Calling getLong here has to be wrong? >> > > No. =A0Large Objects are not stored directly inline, but as a pointer to = other > storage. =A0The getLong is retrieving the external storage which Jdbc4Clo= b > will then stream from the server on demand. =A0You are probably trying to= call > getClob on a text or varchar column and that's not going to work. =A0It m= ight > be nice to provide that interface, but there's no benefit (other than > compatibility) to the user. =A0If you have text data stored inline, then = it's > already been transferred over to the client side in the ResultSet, so > there's no point in using a streaming interface. Yes, it's a TEXT column and yes I'm calling rs.getClob(columnName); What am I suppose to call instead? The above call produces: ... blah ... Caused by: org.postgresql.util.PSQLException: Bad value for type long : url=3Dhttp:// at org.postgresql.jdbc2.AbstractJdbc2ResultSet.toLong(AbstractJdbc2ResultS= et.java:2796) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getLong(AbstractJdbc2Result= Set.java:2019) at org.postgresql.jdbc4.Jdbc4ResultSet.getClob(Jdbc4ResultSet.java:43) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getClob(AbstractJdbc2Result= Set.java:384) getFixedString(columnIndex) method called from AbstractJdbc2ResultSet:2019 is returning an actual column value (String) which toLong is trying to convert to long and failing. Thanks! What am I missing?