From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-general@postgresql.org
Subject: Re: standard LOB support
Date: Fri, 22 Jun 2007 07:45:03 +0200
Message-ID: <f5fnkv$d0t$1@sea.gmane.org> (raw)
In-Reply-To: <019a01c7b483$2331f320$4a0aa8c0@ipljp.local>
References: <00e601c7b3c3$f9136160$4a0aa8c0@ipljp.local>
<019a01c7b483$2331f320$4a0aa8c0@ipljp.local>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: spam_eater@gmx.net, pgsql-general@postgresql.org
Subject: Re: standard LOB support
In-Reply-To: <f5fnkv$d0t$1@sea.gmane.org>
References: <00e601c7b3c3$f9136160$4a0aa8c0@ipljp.local> <019a01c7b483$2331f320$4a0aa8c0@ipljp.local> <f5fnkv$d0t$1@sea.gmane.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox