Re: Selecting large objects stored as bytea

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Selecting large objects stored as bytea
Дата
Msg-id 47BEB14D.2020309@archonet.com
обсуждение исходный текст
Ответ на Selecting large objects stored as bytea  ("Ludger Zachewitz" <ludger.zachewitz@gmx.de>)
Список pgsql-general
Ludger Zachewitz wrote:
> Hello,
>
> I have the following problem accessing postgres (version: 8.2.X) from
> java 1.6_03 using driver (currently version:
> postgresql-8.2-508.jdbc4.jar) and hope someone can help me. I have
> created an table 'files' with the columns 'file_id', 'filename' and
> 'file_content'. 'file_content'is of type bytea and should store large
> binary files. A method for storing files in that table also exists
> and work fine.
>
> Now I am trying to select a stored 'file_content' from the table and
> store it directly on the filesystem. Because the files could be very
> large, i don't want to hold them in the main memory -- so I am using
> Input- and Outputstreams (see source code below).

If you don't want the whole field at once, you don't want a bytea. The
large-object interface offers lo_read/lo_write to let you grab data in
smaller chunks.

See the manuals for details, I'm afraid I'm not sure of the procedure
for accessing lo_read from JDBC.

--
   Richard Huxton
   Archonet Ltd

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

Предыдущее
От: "Ludger Zachewitz"
Дата:
Сообщение: Selecting large objects stored as bytea
Следующее
От: Howard Wilkinson
Дата:
Сообщение: Re: Querying the schema for column widths - what syntax do I use?