This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes JDBC and the fly likes getBytes() or getBlob() fails when resultSet is larger than 1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "getBytes() or getBlob() fails when resultSet is larger than 1" Watch "getBytes() or getBlob() fails when resultSet is larger than 1" New topic
Author

getBytes() or getBlob() fails when resultSet is larger than 1

Cory Tucker
Greenhorn

Joined: Jan 05, 2007
Posts: 2
Hi,

I have a table setup with a column of type BLOB. When I execute a query on the table which returns only one result, I can get the blob data no problem. However, when I execute a query that returns a result set with more than one result, the second time the getBlob() or getBytes() method is called it throws a SQLException and gives the following error:

ERROR XCL30: An IOException was thrown when reading a 'BLOB' from an InputStream.


Here is a snippet of the code I am using:




Does anyone know what might be going wrong?

thanks --Cory
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31057
    
232

Cory,
Welcome to JavaRanch!

Just to confirm, were you able to get just the second icon if you do a query so that it is the only result? This rules out data as being the cause.

What database/driver are you using?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Cory Tucker
Greenhorn

Joined: Jan 05, 2007
Posts: 2
Correct. If I do a query which restricts the resultSet size to 1, then I can get the data just fine.

The DB I am using is JavaDB (aka Derby or Cloudscape). I believe the version is 10.2 (whatever was just released on 12/20/06).
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31057
    
232

Ok. That looks like a message specific to Derby.

An IOException was thrown when reading a '<value>' from an InputStream.

Maybe a network timeout? I haven't used Derby, so I can't provide more specific advice on this.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getBytes() or getBlob() fails when resultSet is larger than 1