Hello,
I am trying to retrieve BLOB from DB2 V8.1 on z/OS to a file
on z/Linux using DB2 Connect as below, but it doesn't work
(this works well for DB2 UDB on Windows):
--
String query = "SELECT images FROM some_table";
ResultSet rs = stmt.executeQuery(query);
InputStream is = rs.getBinaryStream("images");
(omitted)
bin = new BufferedInputStream(is);
byte buf[] = new byte[1024];
int c = 0;
while(true) {
c = bin.read(buf, 0, buf.length); //<-- error occured
if(c == -1) break;
bos.write(buf, 0, c);
}
bos.flush();
--
error:
Caused by: java.io.IOException: DB2Exception: [IBM][JDBC Driver] CLI0620E IOException, error reading from input stream. SQLSTATE=428A1
at COM.ibm.db2.jdbc.app.DB2InputStream.read(DB2InputS tream.java:450)
at java.io.BufferedInputStream.fill(BufferedInputStre am.java(Compiled Code))
I am going to use getBlob() instead of getBinaryStream(),
but does anyone know the solution.
Any help appreciated,
Keitadj