[Re: JDBC compliance]

Поиск
Список
Период
Сортировка
От Barry Lind
Тема [Re: JDBC compliance]
Дата
Msg-id 3E1C4CEB.8090005@xythos.com
обсуждение исходный текст
Ответы Re: [Re: JDBC compliance]  (Abel Muiño <abel.muinho@mundo-r.com>)
Список 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
>




В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Barry Lind
Дата:
Сообщение: Re: ArrayIndexOutOfBoundsException in Encoding.decodeUTF8()
Следующее
От: Barry Lind
Дата:
Сообщение: Re: JDBC driver reports column size of -1 !?