From: Jesper Thorhauge <jth@conzentrate.com>
To: 時期 精霊 <kuon@goyman.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Streaming blob to db
Date: Sat, 02 Jul 2005 10:00:44 +0200
Message-ID: <42C649AC.60403@conzentrate.com> (raw)
In-Reply-To: <15D1FD8F-91C2-4565-B804-E43DDEEC93AB@goyman.com>
References: <15D1FD8F-91C2-4565-B804-E43DDEEC93AB@goyman.com>
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
--
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: jth@conzentrate.com, kuon@goyman.com
Subject: Re: Streaming blob to db
In-Reply-To: <42C649AC.60403@conzentrate.com>
References: <15D1FD8F-91C2-4565-B804-E43DDEEC93AB@goyman.com> <42C649AC.60403@conzentrate.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox