Results 1 to 1 of 1
  1. #1
    Join Date
    Oct 2006
    Posts
    1

    Unanswered: Retrieve BLOB from z/OS

    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
    Last edited by keitadj; 10-05-06 at 08:53.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •