If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Retrieve BLOB from z/OS

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-05-06, 07:49
keitadj keitadj is offline
Registered User
 
Join Date: Oct 2006
Posts: 1
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 07:53.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On