Received: from fargonauten.de (fargonauten.de [212.15.192.193]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eB3GAXF15051 for ; Sun, 3 Dec 2000 11:10:33 -0500 (EST) (envelope-from ingo@t17.fargonauten.de) Received: from bombay.t17.fargonauten.de (t17.fargonauten.de [212.15.197.65]) by fargonauten.de (Postfix) with ESMTP id 9ADA63AC7 for ; Sun, 3 Dec 2000 17:10:28 +0100 (CET) Received: by bombay.t17.fargonauten.de (Postfix, from userid 500) id 5ABCEC008; Sun, 3 Dec 2000 17:13:02 +0100 (CET) Date: Sun, 3 Dec 2000 17:13:02 +0100 From: Ingo Luetkebohle To: pgsql-interfaces@postgresql.org Subject: jdbc: getBinaryStream blocks on second call Message-ID: <20001203171302.B1619@blank.pages.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Organization: Maybe when I grow up X-URL: http://blank.pages.de/ X-Archive-Number: 200012/16 X-Sequence-Number: 353 Hello, I'm using the Postgresql-JDBC interface inside of a Jave Server Page and request a large object. When the page is first called, it works fine. When its called twice for the same database row, the ResultSet.getBinaryStream method blocks infinetely. This is on postgresql 7.0.3 (from RPM, on Linux, glibc). The code is something like: dbc.setAutoCommit(false); Statement st = dbc.createStatement(); ResultSet rs = st.executeQuery("SELECT contents FROM file WHERE id=" + id); dbc.commit(); if(rs.next()) { Reader r = new InputStreamReader(rs.getBinaryStream(1)); char buf[] = new char[2048]; for(int read = r.read(buf); read != -1; read = r.read(buf)) out.write(buf, 0, read); out.flush(); r.close(); is.close(); } (yes, I known that the getBytes method is more convenient but the JspWriter class a JSP page provides can't write byte[], only char[]) -- Ingo Luetkebohle / ingo@blank.pages.de / 95428014 / |PraxisXML Open Source contact; Computational Linguistics |student; Fargonauten.DE sysadmin; Gimp Registry (not-)maintainer;