X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 67D6A52952 for ; Sat, 2 Jul 2005 05:00:56 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37643-06 for ; Sat, 2 Jul 2005 08:00:46 +0000 (GMT) Received: from weber.conzentrate.int (0x55513365.adsl.cybercity.dk [85.81.51.101]) by svr1.postgresql.org (Postfix) with ESMTP id 4FAE05295C for ; Sat, 2 Jul 2005 05:00:44 -0300 (ADT) Received: from [10.10.100.110] (helo=[10.10.100.110]) by weber.conzentrate.int with esmtp (Exim 4.43) id 1DocvS-0005da-2y; Sat, 02 Jul 2005 10:00:34 +0200 Message-ID: <42C649AC.60403@conzentrate.com> Date: Sat, 02 Jul 2005 10:00:44 +0200 From: Jesper Thorhauge User-Agent: Mozilla Thunderbird 1.0.2-1.3.3 (X11/20050513) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?UTF-8?B?5pmC5pyfIOeyvumcig==?= Cc: pgsql-jdbc@postgresql.org Subject: Re: Streaming blob to db References: <15D1FD8F-91C2-4565-B804-E43DDEEC93AB@goyman.com> In-Reply-To: <15D1FD8F-91C2-4565-B804-E43DDEEC93AB@goyman.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.164 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200507/11 X-Sequence-Number: 13159 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 --