Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id C992C6335E1 for ; Mon, 1 Feb 2010 16:16:05 -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 61024-02 for ; Mon, 1 Feb 2010 20:15:51 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from leary.csoft.net (leary.csoft.net [205.205.214.5]) by mail.postgresql.org (Postfix) with ESMTP id 6F6D86331D6 for ; Mon, 1 Feb 2010 16:15:54 -0400 (AST) Received: by leary.csoft.net (Postfix, from userid 1112) id 677B1A373; Mon, 1 Feb 2010 15:15:52 -0500 (EST) Date: Mon, 1 Feb 2010 15:15:52 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Nedim Cholich cc: pgsql-jdbc@postgresql.org Subject: Re: Jdbc4ResultSet getClob and getBlob are calling getLong internally In-Reply-To: <2f8a6c901002011053w4ec6425bodb502c67d4e2b2dc@mail.gmail.com> Message-ID: References: <2f8a6c901002011053w4ec6425bodb502c67d4e2b2dc@mail.gmail.com> User-Agent: Alpine 2.00 (BSO 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.47 tagged_above=-10 required=5 tests=AWL=-0.027, BAYES_00=-2.599, SUBJECT_FUZZY_TION=0.156 X-Spam-Level: X-Archive-Number: 201002/2 X-Sequence-Number: 20289 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: > > public java.sql.Clob getClob(int i) throws SQLException > { > return new Jdbc4Clob(connection, getLong(i)); > } > > Calling getLong here has to be wrong? > No. Large Objects are not stored directly inline, but as a pointer to other storage. The getLong is retrieving the external storage which Jdbc4Clob will then stream from the server on demand. You are probably trying to call getClob on a text or varchar column and that's not going to work. It might be nice to provide that interface, but there's no benefit (other than compatibility) to the user. If 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. Kris Jurka