Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id BD58A9FB442 for ; Fri, 22 Jun 2007 02:45:47 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 29343-09 for ; Fri, 22 Jun 2007 02:45:44 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by postgresql.org (Postfix) with ESMTP id D0CAB9FB438 for ; Fri, 22 Jun 2007 02:45:43 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1I1bxM-0006Wu-SE for pgsql-general@postgresql.org; Fri, 22 Jun 2007 07:45:17 +0200 Received: from ppp-82-135-68-58.dynamic.mnet-online.de ([82.135.68.58]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 22 Jun 2007 07:45:16 +0200 Received: from spam_eater by ppp-82-135-68-58.dynamic.mnet-online.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 22 Jun 2007 07:45:16 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-general@postgresql.org From: Thomas Kellerer Subject: Re: standard LOB support Date: Fri, 22 Jun 2007 07:45:03 +0200 Lines: 25 Message-ID: References: <00e601c7b3c3$f9136160$4a0aa8c0@ipljp.local> <019a01c7b483$2331f320$4a0aa8c0@ipljp.local> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: ppp-82-135-68-58.dynamic.mnet-online.de User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.4) Gecko/20070604 Thunderbird/2.0.0.4 Mnenhy/0.7.5.666 In-Reply-To: <019a01c7b483$2331f320$4a0aa8c0@ipljp.local> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/1297 X-Sequence-Number: 116120 EBIHARA, Yuichiro wrote on 22.06.2007 06:09: > It seems like PG JDBC driver CANNOT handle 'bytea' as BLOB nor 'text' as CLOB. > getBlob()/setBlob()/getClob()/setClob() can work with only Large Objects (at least with > postgresql-8.1-405.jdbc3.jar). > > org.postgresql.util.PSQLException: Bad Integer Z\273\330x\336\335\226\243 > at org.postgresql.jdbc1.AbstractJdbc1ResultSet.toInt(AbstractJdbc1ResultSet.java:862) > at org.postgresql.jdbc1.AbstractJdbc1ResultSet.getInt(AbstractJdbc1ResultSet.java:287) > at org.postgresql.jdbc3.Jdbc3ResultSet.getBlob(Jdbc3ResultSet.java:42) > at PgTest.main(PgTest.java:33) > > The same exception occurs when using getClob() against a text column. > > Using Large Objects may solve my issue but I have to note that a large object is not automatically > deleted when the record referring to it is deleted. > I found that using getBinaryStream(), setBinaryStream(), getCharacterStream() and setCharacterStream() to handle LOBs across different DBMS is much more portable (and reliably) than using the Clob()/Blob() methods. The Postgres JDBC driver handles the stream/writer methods just fine to read and write text and bytea columns. Thomas