wood burning stoves 2.0*
The moose likes JDBC and the fly likes Reading InputStream - ExtendedIOException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Reading InputStream - ExtendedIOException" Watch "Reading InputStream - ExtendedIOException" New topic
Author

Reading InputStream - ExtendedIOException

Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Hi there. I have some data stored in a DB2 database as a BLOB data type. I am retrieving this data from the database and putting it into an ArrayList as an InputStream object.

I then loop through the ArrayList of InputStream objects to output the images to a JTextPane.
This is the code I am using to insert the images:


However when it tries to execute the "while (is.read(buffer) > 0)"
it returns the following exception:

com.ibm.as400.access.ExtendedIOException: Resource not available.
at com.ibm.as400.access.AS400JDBCInputStream.read(AS400JDBCInputStream.java:201)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at java.io.FilterInputStream.read(Unknown Source)

I can't seem to figure out exactly what is the issue here? Any ideas?
Thanks for any help!
Samuel March
Ranch Hand

Joined: Oct 28, 2009
Posts: 39
byte[] buffer = new byte[1];
BufferedInputStream is = new BufferedInputStream(imageIS);


To start, you only nominated 1 byte worth to have on the array, images are generally composed of more than one byte.

Look at the API docs for the construction call for BufferedInputStream , because for what your doing
my memory is there is a declaration system for what your trying to do thatgose more like this

byte[] buffer; // is declared as nominated for the BufferedInputStream
streambuffer = new BufferedInputStream(buffer);
while(streambuffer.read(A BYTE)).....


...did you have the fish?!............................ No.
Samuel March
Ranch Hand

Joined: Oct 28, 2009
Posts: 39
From much wondering exactly how those streams logically come about! , here is something to look through.

Fatih Keles
Ranch Hand

Joined: Sep 01, 2005
Posts: 182
Jennifer Sohl wrote:Hi there. I have some data stored in a DB2 database as a BLOB data type. I am retrieving this data from the database and putting it into an ArrayList as an InputStream object.

I then loop through the ArrayList of InputStream objects to output the images to a JTextPane.
This is the code I am using to insert the images:

However when it tries to execute the "while (is.read(buffer) > 0)"
it returns the following exception:

com.ibm.as400.access.ExtendedIOException: Resource not available.
at com.ibm.as400.access.AS400JDBCInputStream.read(AS400JDBCInputStream.java:201)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at java.io.FilterInputStream.read(Unknown Source)


InputStream imageIS is not available. Either the driver version you are using could not return an input stream for your BLOB data or the stream is closed before it reaches your method may be because you close your database connection.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reading InputStream - ExtendedIOException
 
Similar Threads
Retrieving image from access database
getOutputStream() has already been called for this response
Accessing image from ms-access
Accessing Image from ms-access
Merging byte arrays using SequenceInputStream