RE: jdbc: getBinaryStream blocks on second call

From: Peter Mount <petermount(at)maidstone(dot)gov(dot)uk>
To: "'Ingo Luetkebohle'" <ingo(at)blank(dot)pages(dot)de>, pgsql-interfaces(at)postgresql(dot)org
Subject: RE: jdbc: getBinaryStream blocks on second call
Date: 2000-12-05 14:40:55
Message-ID: 1B3D5E532D18D311861A00600865478CF1B60F@exchange1.nt.maidstone.gov.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

What is "is" here, ie: the is.close() line?

--
Peter Mount
Enterprise Support Officer, Maidstone Borough Council
Email: petermount(at)maidstone(dot)gov(dot)uk
WWW: http://www.maidstone.gov.uk
All views expressed within this email are not the views of Maidstone Borough
Council

> -----Original Message-----
> From: Ingo Luetkebohle [mailto:ingo(at)blank(dot)pages(dot)de]
> Sent: Sunday, December 03, 2000 4:13 PM
> To: pgsql-interfaces(at)postgresql(dot)org
> Subject: [INTERFACES] jdbc: getBinaryStream blocks on second call
>
>
> 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(at)blank(dot)pages(dot)de / 95428014
> /
> |PraxisXML Open Source contact; Computational Linguistics
> |student; Fargonauten.DE sysadmin; Gimp Registry (not-)maintainer;
>

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Peter Mount 2000-12-05 14:43:07 RE: jdbc: getBinaryStream blocks on second call
Previous Message Richard Holland 2000-12-05 14:40:39 Converting Access tables to PostGre