X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6A611D9AEB for ; Wed, 28 Sep 2005 17:27:23 -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 99340-04 for ; Wed, 28 Sep 2005 20:27:18 +0000 (GMT) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.198]) by svr1.postgresql.org (Postfix) with ESMTP id EA204D9B0B for ; Wed, 28 Sep 2005 17:27:16 -0300 (ADT) Received: by xproxy.gmail.com with SMTP id s14so1554080wxc for ; Wed, 28 Sep 2005 13:27:19 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:mime-version:content-type; b=RRTBYW7xMon+Tc8C2mg93ZKOgpojAJVjWokNP9wiomeikGM4Toi4IYjPVzy4iZpccmn6pKA/C6UUEQbRoo2OTNYUE1fgrVZMdBinwvKsvqsH1AlaXf5XDdiv1VpAaivz3WT9Ah//XkFvQFMRcXLV4aryHia03siziELMe99X1AQ= Received: by 10.70.25.7 with SMTP id 7mr12616wxy; Wed, 28 Sep 2005 13:27:19 -0700 (PDT) Received: by 10.70.41.14 with HTTP; Wed, 28 Sep 2005 13:27:19 -0700 (PDT) Message-ID: <89cc056d050928132714e17730@mail.gmail.com> Date: Wed, 28 Sep 2005 16:27:19 -0400 From: Alfredo Rico Reply-To: Alfredo Rico To: pgsql-jdbc@postgresql.org Subject: How to retieve binary data (bytea) without problem ? Cc: Kris Jurka MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_6251_17861594.1127939239124" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.84 required=5 tests=[AWL=0.729, HTML_40_50=0.086, HTML_MESSAGE=0.001, RCVD_BY_IP=0.024] X-Spam-Level: X-Archive-Number: 200509/120 X-Sequence-Number: 13905 ------=_Part_6251_17861594.1127939239124 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi friends, greetings :-) I'm using PostgreSQL v7.4.7 with JDBC driver version 8.0 Build 312 in a Jav= a Web Deveploment. I have a table named 'attachedfiles' in which there is a column used to store binary data (bytea type) (pdf's files, doc, png, jpg, what ever...). I have stored, without troubles, binary data reaching 30 MB. To retrieve the binary data I'm using the following Java code: PreparedStatement ps =3D this.con.prepareStatement("SELECT contentfile from attachedfiles where filename =3D ? ", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); ps.setString(1,"UsingJDBC.pdf"); bytes filebinary[] =3D null; ResultSet rs =3D ps.executeQuery(); if (rs !=3D null) { while (rs.next()) //Only one row { filebinary =3D rs.getBytes(1); //Obtain the file... } rs.close(); } ps.close(); Problem: If the binary data that I want to retrieve, is up to 12 MB, I obtain a java.lang.OutOfMemoryError: Java Heap Space. I'm using NetBeans 4.1 and a I have increased the JVM heap size uing the following comand at momento to start Netbeans IDE $ ./netbeans -J-Xmx300m but this don't work. How could I overcome this error ? Thanks in advance by your help and support. Kind Regards.- Alfredo Rico. ------=_Part_6251_17861594.1127939239124 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi friends, greetings :-)

I'm using PostgreSQL v7.4.7 with JDBC driver version 8.0 Build 312 in a Jav= a Web Deveploment.

I have a table named 'attachedfiles' in which there is a column used to store binary data (bytea type) (pdf's files, doc, png, jpg, what ever...).

I have stored, without troubles, binary data reaching 30 MB.

To retrieve the binary data I'm using the following Java code:

PreparedStatement ps =3D this.con.prepareStatement("S= ELECT contentfile from attachedfiles where filename =3D ? ", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
ps.setString(1,"UsingJDBC.pdf");     &nb= sp;    
bytes filebinary[] =3D null;           &nbs= p;           
ResultSet rs =3D ps.executeQuery();
if (rs !=3D null)
{
      while (rs.next()) //Only one row
      {            &n= bsp;            = ;            &n= bsp;      
            &nb= sp;   filebinary =3D rs.getBytes(1);  //Obtain the file...
       }
      rs.close();
}
ps.close();



Problem:
If the binary data that I want to retrieve, is up to 12 MB, I obtain a java= .lang.OutOfMemoryError: Java Heap Space.

I'm using NetBeans 4.1 and a I have increased the JVM heap size uing the fo= llowing comand at momento to start Netbeans IDE

$ ./netbeans -J-Xmx300m

but this don't work.

How could I overcome this error ?

Thanks in advance by your help and support.

Kind Regards.-
Alfredo Rico. ------=_Part_6251_17861594.1127939239124--