Home > Archive > PostgreSQL JDBC > July 2005 > Re: Streaming blob to db









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Streaming blob to db
Kris Jurka

2005-07-04, 7:23 am



On Fri, 1 Jul 2005, [UTF-8] æ^Y^Bæ^\^_ ç²¾é^\Š wrote:
>
> I got a web application that use jdbc and that will need to stream
> binary data to the database.
>
> My application need an outputstream to send the data to the db, and
> an inputstream to read the data from the db.
>
> I use postgresql 8.0.1 with bytea field.
>
>


If you are really dealing with 100+Mb files you should probably look into
using large objects instead of bytea storage. This will provide the
streaming interfaces you are looking for and avoid excessive memory usage.

http://jdbc.postgresql.org/document...inary-data.html

Kris Jurka

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql
.org so that your
message can get through to the mailing list cleanly

時期 精霊

2005-07-05, 7:23 am

How can I trigger the deletion of the large object when the row
containing the oid is deleted?

I mean I know that:
DELETE FROM pg_largeobject WHERE loid = nnn

But is there in jdbc, an automatic way to handle that?

Regards

Kuon

On Jul 4, 2005, at 11:33 AM, Kris Jurka wrote:

>
>
> On Fri, 1 Jul 2005, [UTF-8] æ^Y^Bæ^\^_ ç²¾é^\Š wrote:
>
>
> If you are really dealing with 100+Mb files you should probably
> look into
> using large objects instead of bytea storage. This will provide the
> streaming interfaces you are looking for and avoid excessive memory
> usage.
>
> http://jdbc.postgresql.org/document...inary-data.html
>
> Kris Jurka
>



---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Roland Walter

2005-07-05, 9:24 am

時期 精霊 schrieb:

> How can I trigger the deletion of the large object when the row
> containing the oid is deleted?
>
> I mean I know that:
> DELETE FROM pg_largeobject WHERE loid = nnn
>
> But is there in jdbc, an automatic way to handle that?
>


There is a vacuumlo program in the contrib directory of the
database source. If the contributed programs are installed you
should have it. The readme for it is usually installed in
the directory doc/contrib in the directory of the database installation.


--
Roland Walter phone: +49 (0) 22 25 / 88 2-41 1
MOSAIC SOFTWARE AG fax: +49 (0) 22 25 / 88 2-20 1
Am Pannacker 3 mailto: rwa (at) mosaic-ag (dot) com
D-53340 Meckenheim http://www.mosaic-ag.com

------- L E G A L D I S C L A I M E R ---------

Die Informationen in dieser Nachricht sind vertraulich
und ausschliesslich fuer den Adressaten bestimmt.
Kenntnisnahme durch Dritte ist unzulaessig. Die
Erstellung von Kopien oder das Weiterleiten an weitere,
nicht originaere und benannte Adressaten ist nicht
vorgesehen und kann ungesetzlich sein. Die Meinungen
in dieser Nachricht stellen lediglich die Meinungen
des Senders dar. Falls Sie vermuten, dass diese
Nachricht veraendert wurde, setzen Sie sich mit dem
Absender in Verbindung. Der Absender uebernimmt ohne
weitere Ueberpruefung keine Verantwortung fuer die
Richtigkeit und Vollstaendigkeit des Inhalts. Unbefugte
Empfaenger werden gebeten, die Vertraulichkeit der
Nachricht zu wahren und den Absender sofort ueber
einen Uebertragungsfehler zu informieren.
------------------------------------------------------


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Tom Lane

2005-07-05, 9:24 am

Roland Walter <rwa@mosaic-ag.com> writes:
> 時期 精霊 schrieb:
[color=darkred]
> There is a vacuumlo program in the contrib directory of the
> database source.


Also see contrib/lo for a trigger you can install to delete blobs
immediately when the reference is deleted.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com