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 F0ED33A4D48 for ; Sat, 27 Nov 2004 13:57:17 +0000 (GMT) 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 07683-04 for ; Sat, 27 Nov 2004 13:57:10 +0000 (GMT) Received: from cougar.DIT.UMontreal.CA (chene.DIT.UMontreal.CA [132.204.246.20]) by svr1.postgresql.org (Postfix) with ESMTP id BBAB13A4D1E for ; Sat, 27 Nov 2004 13:57:11 +0000 (GMT) Received: from chene.dit.umontreal.ca(132.204.246.20) by cougar.DIT.UMontreal.CA via csmap id 3ce72790_407c_11d9_9cc4_0002b39fa8dc_10802; Sat, 27 Nov 2004 08:57:14 -0500 (EST) Received: from cougar.DIT.UMontreal.CA (gw-mail.LEXUM.UMontreal.CA [132.204.136.52]) by chene.DIT.UMontreal.CA (8.13.1/8.13.1) with ESMTP id iARDv986011742 for ; Sat, 27 Nov 2004 08:57:09 -0500 Received: from gw-mail.lexum.umontreal.ca(132.204.136.52) by cougar.DIT.UMontreal.CA via csmap id 3b2166aa_407c_11d9_9d1b_0002b39fa8dc_10722; Sat, 27 Nov 2004 08:57:09 -0500 (EST) Received: from [192.168.1.101] ([::ffff:70.80.14.117]) (AUTH: PLAIN paree, SSL: TLSv1/SSLv3,256bits,AES256-SHA) by mail.lexum.umontreal.ca with esmtp; Sat, 27 Nov 2004 08:55:13 -0500 id 0000BBC7.41A88741.00001C0E Subject: Re: Is there a size limit on setBinaryStream? From: "=?ISO-8859-1?Q?=C9ric_Par=E9?=" Reply-To: paree@LEXUM.UMontreal.CA To: jonathan.lister@vaisala.com Cc: pgsql-jdbc@postgresql.org In-Reply-To: <0077BA604D38D311918B00508B44425802AAEA34@birsrv01.vaisala.com> References: <0077BA604D38D311918B00508B44425802AAEA34@birsrv01.vaisala.com> Organization: LexUM Message-Id: <1101563797.3320.2.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=_roma.dmz.lexum.pri-7186-1101563714-0001-2" X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Sat, 27 Nov 2004 08:56:37 -0500 X-NAI-Spam-Score: 1.4 X-NAI-Spam-Level: * X-NAI-Spam-Rules: 2 Rules triggered HTML_40_50=1.3, HTML_MESSAGE=0.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.5 tagged_above=0.0 required=5.0 tests=HTML_20_30, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200411/217 X-Sequence-Number: 11639 This is a MIME-formatted message. If you see this text it means that your E-mail software does not support MIME-formatted messages. --=_roma.dmz.lexum.pri-7186-1101563714-0001-2 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Mime-Autoconverted: from 8bit to quoted-printable by courier 0.47 Check to see if f2.length() is larger than Integer.MAX_SIZE with your big file. -- =C9ric Par=E9 for/pour LexUM Universit=E9 de Montr=E9al Centre de recherche en droit public C.P. 6128, succ. Centre-ville Montr=E9al (Qc) Canada H3C 3J7 +1 514-343-6111 #0873 paree@lexum.umontreal.ca --=_roma.dmz.lexum.pri-7186-1101563714-0001-2 Content-Type: message/rfc822 Content-Disposition: inline Content-Description: Forwarded message - [JDBC] Is there a size limit on setBinaryStream? Delivered-To: paree@lexum.umontreal.ca Return-Path: Received: from cougar.DIT.UMontreal.CA ([::ffff:132.204.246.24]) by mail.lexum.umontreal.ca with esmtp; Sat, 27 Nov 2004 08:05:38 -0500 id 0000BBC1.41A87BA2.000019D6 Received: from caryer.dit.umontreal.ca(132.204.246.24) by cougar.DIT.UMontreal.CA via csmap id 4911e020_4075_11d9_86a5_0002b39fa8dc_20625; Sat, 27 Nov 2004 08:07:34 -0500 (EST) Received: from cougar.DIT.UMontreal.CA (svr4.postgresql.org [66.98.251.159]) by caryer.DIT.UMontreal.CA (8.13.1/8.13.1) with ESMTP id iARD7O6f021208 for ; Sat, 27 Nov 2004 08:07:25 -0500 Received: from svr4.postgresql.org(66.98.251.159) by cougar.DIT.UMontreal.CA via csmap id 47f06374_4075_11d9_9960_0002b39fa8dc_20608; Sat, 27 Nov 2004 08:07:25 -0500 (EST) Received: from postgresql.org (svr1.postgresql.org [200.46.204.71]) by svr4.postgresql.org (Postfix) with ESMTP id 5F0A65AF777; Sat, 27 Nov 2004 13:07:21 +0000 (GMT) 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 64D013A4CF8 for ; Sat, 27 Nov 2004 13:05:54 +0000 (GMT) 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 94866-01 for ; Sat, 27 Nov 2004 13:05:41 +0000 (GMT) Received: from mailgw.vaisala.com (mailgw.vaisala.com [192.81.123.24]) by svr1.postgresql.org (Postfix) with ESMTP id A38253A4CA6 for ; Sat, 27 Nov 2004 13:05:42 +0000 (GMT) Received: from helsrv02.vaisala.com (helsrv02.vaisala.com [192.81.123.16]) by mailgw.vaisala.com (8.12.8/8.12.8) with SMTP id iARD5kIU024630 for ; Sat, 27 Nov 2004 15:05:46 +0200 Received: From helsrv01.vaisala.com ([192.81.123.18]) by helsrv02.vaisala.com (WebShield SMTP v4.5 MR1a P0803.345); id 1101560740638; Sat, 27 Nov 2004 15:05:40 +0200 Received: by helsrv01.vaisala.com with Internet Mail Service (5.5.2651.30) id ; Sat, 27 Nov 2004 15:05:39 +0200 Message-ID: <0077BA604D38D311918B00508B44425802AAEA34@birsrv01.vaisala.com> From: jonathan.lister@vaisala.com To: pgsql-jdbc@postgresql.org Subject: [JDBC] Is there a size limit on setBinaryStream? Date: Sat, 27 Nov 2004 15:05:37 +0200 Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=_roma.dmz.lexum.pri-7186-1101563714-0001-3" X-Mailer: Internet Mail Service (5.5.2651.30) X-Virus-Scanned: by amavisd-new at hub.org X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org X-NAI-Spam-Score: -0.4 X-NAI-Spam-Rules: 3 Rules triggered FORGED_IMS_TAGS=-1.3, HTML_50_60=0.9, HTML_MESSAGE=0.1 X-Spam-Checker-Version: SpamAssassin 3.0.1 (2004-10-22) on mail.lexum.umontreal.ca X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=FORGED_RCVD_HELO, HTML_60_70, HTML_MESSAGE, NO_REAL_NAME autolearn=no version=3.0.1 This is a MIME-formatted message. If you see this text it means that your E-mail software does not support MIME-formatted messages. --=_roma.dmz.lexum.pri-7186-1101563714-0001-3 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit I am using pg74.215.jdbc3.jar and sever version() is: PostgreSQL 7.4.6 on i486-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6). Server setup is "out of the box" apart from PGOPTS="-N 16 -B 2048 -i" (N was reduced from 1024 to get the server to start .. host machine has 128mb ram) My code is very similar to the example given in the documentation. It seems to work OK for files up to around 780k, but when I try a larger file (e.g. 5,498k it seems to just "hang" .. no exception, no error report). c.setAutoCommit(false); try { File f2 = new File(fullPath); FileInputStream is = new FileInputStream(f2); int image_type_id = 1; log.info("uploading file " + fullPath + " size " + f2.length()); PreparedStatement ps = c.prepareStatement("insert into photo (catalog_id, image_type_id, width, height, picture) values(?, ?, ?, ?, ? )"); ps.setInt(1,catalog_id); ps.setInt(2,image_type_id); ps.setInt(3,width); ps.setInt(4,height); // setBinaryStream seems to work ok with small files, not with larger files ps.setBinaryStream(5,is,(int)f2.length()); ps.executeUpdate(); ps.close(); is.close(); c.commit(); } and the definition of photo table is: create table photo ( catalog_id int, image_type_id int, width int, height int, picture bytea, foreign key (catalog_id) references catalog(id), foreign key (image_type_id) references image_type(id) ); create index photo_cat_id_idx on photo (catalog_id); --=_roma.dmz.lexum.pri-7186-1101563714-0001-3 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 7bit Is there a size limit on setBinaryStream?

I am using pg74.215.jdbc3.jar and sever version() is: PostgreSQL 7.4.6 on i486-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6). Server setup is "out of the box" apart from PGOPTS="-N 16 -B 2048 -i" (N was reduced from 1024 to get the server to start .. host machine has 128mb ram)

My code is very similar to the example given in the documentation. It seems to work OK for files up to around 780k, but when I try a larger file (e.g. 5,498k it seems to just "hang" .. no exception, no error report).

 
          c.setAutoCommit(false);
          try
          {
            File f2 = new File(fullPath);           
            FileInputStream is = new FileInputStream(f2);
            int image_type_id = 1;
            log.info("uploading file " + fullPath + " size " + f2.length());
            PreparedStatement ps = c.prepareStatement("insert into photo (catalog_id, image_type_id, width, height, picture) values(?, ?, ?, ?, ? )");

            ps.setInt(1,catalog_id);
            ps.setInt(2,image_type_id);
            ps.setInt(3,width);
            ps.setInt(4,height);
            // setBinaryStream seems to work ok with small files, not with larger files
            ps.setBinaryStream(5,is,(int)f2.length());
            ps.executeUpdate();
            ps.close();
            is.close();
            c.commit();
         }

and the definition of photo table is:
create table photo
(
  catalog_id int,
  image_type_id int,
  width int,
  height int,
  picture bytea,
    foreign key (catalog_id) references catalog(id),
    foreign key (image_type_id) references image_type(id)
);
create index photo_cat_id_idx on photo (catalog_id);

--=_roma.dmz.lexum.pri-7186-1101563714-0001-3-- --=_roma.dmz.lexum.pri-7186-1101563714-0001-2--