Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Blob Inputstream Reading

 
Mark Reyes
Ranch Hand
Posts: 426
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to read a blob file from my table but I am encountering an error during reading at the outputstream.



Here's the code during writing at the output stream.


During reading, I am encountering this error java.io.IOException: The stream is closed
I am using MSSQL Type 4 JDBC Driver so I am not sure if this is related to the driver.

 
Tom Reilly
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suspect it's the

that is closing your stream. Try moving the offending close() to after you reading the stream.
 
Mark Reyes
Ranch Hand
Posts: 426
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tom,

I suspect it's the that is closing your stream. Try moving the offending close() to after you reading the stream.


Thanks. But I already use a data transfer object (FileAttachment) to transfer my resultsets so thats why I close all my DB related objects



I thought in a production environment, DB access should not extend beyond the business logic part. I just coded everything here since
I am just testing it.

 
Tom Reilly
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So are you saying you tried my suggestion and it didn't work?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mark reyes wrote:I thought in a production environment, DB access should not extend beyond the business logic part. I just coded everything here since

Correct. However that is not what this line of code does:

The binary stream is not a self contained file. It is a pointer to the database. It would be better to process the file in the business logic part.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic