Re: Streaming blob to db

From: Jesper Thorhauge <jth(at)conzentrate(dot)com>
To: 時期 精霊 <kuon(at)goyman(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Streaming blob to db
Date: 2005-07-02 08:00:44
Message-ID: 42C649AC.60403@conzentrate.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

--

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Nidhi Srivastava 2005-07-04 04:29:41 Re: Create Database using JDBC
Previous Message Scott Marlowe 2005-07-01 17:15:49 Re: XA support