Good idea. Having not worked much with streams before, this idea didn't strike me, or I was rather unaware about this possibility. I will try to implement this, and let you know whether this worked or not.
--- On Tue, 16/2/10, Bryan Pendleton <email@example.com> wrote:
From: Bryan Pendleton <firstname.lastname@example.org>
Subject: Re: 'ERROR 40XD0: Container has been closed.: java.io.IOException'.
To: "Derby Discussion" <email@example.com>
Date: Tuesday, 16 February, 2010, 7:17 AM
> ResultSet rs = con.createStatement().executeQuery(
"select * from TABLE1");
> InputStream is = rs.getBinaryStream(1);
> long length = rs.getBlob(1).length();
> ps = con.prepareStatement("update table1 set photo = ?");
> ps.setBinaryStream(1, is, length);
I think it's problematic to try to hold on to the stream after
you've closed the ResultSet.
What happens if you read the stream fully into memory (say,
copying it into a ByteArrayOutputStream), before closing the
result set, and then use your in-memory byte array to provide
the data for the update into the other table?