Re: jdbc lob and postgresql

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: jdbc lob and postgresql
Дата
Msg-id Pine.BSO.4.64.0712130221100.28231@leary.csoft.net
обсуждение исходный текст
Ответ на Re: jdbc lob and postgresql  (Thomas Kellerer <spam_eater@gmx.net>)
Ответы Re: jdbc lob and postgresql  (Thomas Kellerer <spam_eater@gmx.net>)
Список pgsql-general

On Thu, 13 Dec 2007, Thomas Kellerer wrote:

>> I am contemplating to use postgresql for a product that requires to
>> manipulate many blobs.
>> From the documentation I am not clear if one has to use postgres api to
>> insert/update/select blobs or one can use standard jdbc api?
>> Can I just execute a statement insert into (..) that has a blob and do a
>> getBlob to retrieve it?
>
> Using a PreparedStatement with setBinaryStream() to insert the blob and
> getBinaryStream() to read the BLOB works fine for me.
>

It depends how you want to handle binary data on the server side.
get/setBinaryStream only work with the bytea data type.  getBlob/setBlob
only work with real large objects (oid data type).  Both methods work,
it's just a tradeoff on how you want handle it on the server.  The API
downside of Blob is that only JDBC4 offers a portable way to create a Blob
(Connection.createBlob) and the pg driver does not implement that yet.

Kris Jurka

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

Предыдущее
От: Ken Johanson
Дата:
Сообщение: Re: RETURNING clause: how to specifiy column indexes?
Следующее
От: "D. Dante Lorenso"
Дата:
Сообщение: Re: Need LIMIT and ORDER BY for UPDATE