[Re: JDBC compliance]

From: Barry Lind <blind(at)xythos(dot)com>
To: abel(dot)muinho(at)mundo-r(dot)com
Cc: PostgreSQL JDBC <pgsql-jdbc(at)postgresql(dot)org>
Subject: [Re: JDBC compliance]
Date: 2003-01-08 16:08:11
Message-ID: 3E1C4CEB.8090005@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


Abel,

The problem is that Postgres doesn't have a datatype that supports BLOB
and CLOB very well. There are two different datatypes that come close
(bytea and LargeObjects/oid). The pros and cons of each type can be
found in the jdbc chapter of the postgres documentation in the section
on Storing Binary Data.

In 7.1 and earlier only the LargeObject way of doing things was
supported. In 7.2 the bytea way was added. But unfortunately this has
left the driver in a bit of a confused state as you point out.

I am not sure this will change in the near future until the server has a
datatype the better matches the ansi BLOB/CLOB types.

If you haven't done so, I would strongly suggest reading the above
mentioned documentation.

The problem with setBinaryStream() is that the driver doesn't know the
underlying datatype in the database. So it has to infer from the set
method what the datatype is. For things like setString, setTimestamp
that is easy, however for some (setBinaryStream in this case) it isn't
as straight forward.

thanks,
--Barry

Abel Muiño wrote:
> Hello.
>
> I'm evolving an application where BLOBs and CLOBs where being used over
> Oracle. Now I'm extending this to use other databases, but I've found
> that PostgreSQL support for them is "broken".
>
> According to the JDBC standard (downloadable from
> http://java.sun.com/products/jdbc/download.html#corespec30) section
> 16.3.2: "The setBinaryStream and setObject methods may also be used to
> set a Blob object as a parameter in a PreparedStatement object.".
>
> But postgres' JDBC driver uses "bytea" database type for
> setBinaryStream and "oid" (large object interface) when using getBlob.
>
> I have worked around it by falling back to the 7.1 compatible mode,
> where Large Objects were used for both, but I would like to know which
> is the current state of this issue.
>
> Thanks a lot.
>
> --
> Abel.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Abel Muiño 2003-01-08 16:31:25 Re: [Re: JDBC compliance]
Previous Message Kovács Péter 2003-01-08 15:08:07 AW: [JDBC] Problem: commit doesn´t work