X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 318C252E9C for ; Thu, 11 Aug 2005 15:09:56 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76362-03 for ; Thu, 11 Aug 2005 18:09:54 +0000 (GMT) Received: from mra01.ch.as12513.net (mra01.ch.as12513.net [82.153.252.23]) by svr1.postgresql.org (Postfix) with ESMTP id 5D5D452BE2 for ; Thu, 11 Aug 2005 15:09:53 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mra01.ch.as12513.net (Postfix) with ESMTP id 1781C28C4AE for ; Thu, 11 Aug 2005 19:09:54 +0100 (BST) Received: from mra01.ch.as12513.net ([127.0.0.1]) by localhost (mra01.ch.as12513.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 20133-01-83 for ; Thu, 11 Aug 2005 19:09:53 +0100 (BST) Received: from [10.0.0.150] (unknown [81.5.146.249]) by mra01.ch.as12513.net (Postfix) with ESMTP id 7BAFB28C476 for ; Thu, 11 Aug 2005 19:09:53 +0100 (BST) Message-ID: <42FB946C.2090603@rkcomputing.co.uk> Date: Thu, 11 Aug 2005 19:09:48 +0100 From: Rob Kirkbride User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Bug with blobs? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by Eclipse VIRUSshield at eclipse.net.uk X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=[none] X-Spam-Level: X-Archive-Number: 200508/79 X-Sequence-Number: 13648 Hi, I was getting an exception thrown when using Hibernate to read blobs but I've pared it down to something very simple - hopefully it's just something silly. Here's the snippet of code :- String query = "select imageblob from tempimages where id=1"; Connection con; PreparedStatement s; ResultSet rs; try { Class.forName(driver); con = DriverManager.getConnection(url, username, password); s = con.prepareStatement(query); rs = s.executeQuery(); rs.next(); java.sql.Blob blob = rs.getBlob("imageblob"); It throws a org.postgresql.util.PSQLException: Bad value for type int : \377\330\377\340\000 .... at org.postgresql.jdbc2.AbstractJdbc2ResultSet.toInt(AbstractJdbc2ResultSet.java:2528) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getInt(AbstractJdbc2ResultSet.java:2003) at org.postgresql.jdbc3.Jdbc3ResultSet.getBlob(Jdbc3ResultSet.java:55) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getBlob(AbstractJdbc2ResultSet.java:323) at PgTest.run(PgTest.java:46) at PgTest.main(PgTest.java:63) This is with postgresql 8.0.3 and version 312 of the driver (on Linux) Help, help! - What am I doing wrong!? Thanks for any help, Rob