Re: Streaming blob to db - Mailing list pgsql-jdbc

From Jesper Thorhauge
Subject Re: Streaming blob to db
Date
Msg-id 42C649AC.60403@conzentrate.com
Whole thread Raw
In response to Streaming blob to db  (時期 精霊 <kuon@goyman.com>)
List pgsql-jdbc
Hi Kuon

Use the standard jdbc method on a PreparedStatement, called
setBinaryStream(..) (using version 8.0.x of the driver). The bad thing
is that getting the data out from database using getBinaryStream(..)
will use a lot of memory relative to the filesize - there seems to be no
way to avoid this. Look elsewhere in the archives for an explanation by
Oliver on this issue...

Regards
Jesper

時期 精霊 wrote:

> Hello,
>
> 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 seeked the web but I did not found any working example.
>
> I use postgresql 8.0.1 with bytea field.
>
> The data size will be around:
>
> <1mb 50%
> 1 - 100mb 30%
> >100mb 20%
>
> Any idea of the best approach?
>
> Regards
>
> Kuon



--



pgsql-jdbc by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: XA support
Next
From: Jonas Partner
Date:
Subject: Write to outputstream in PGStream blocks indefinitely