Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reading Blob without knowing the filename

 
Janine Guenther
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i try to read a Blob, but i don't know the filename of it.
In all examles i found, there is an FileOutputStream(filePath). In the database ist no field for the filename only a field for the Blob.
I know, if i would save a blob into a database, oracle is saving the filename as an attribute/param in this blob-field. How can i read this attribute/param?
Regards,
Janine
example:
in = blob.getBinaryStream();
String filePath = absPath + fileName;
out = new FileOutputStream(filePath);
int bufferSize = blob.getBufferSize();
byte[] buffer = new byte[bufferSize];
int bytesRead = 0;
while ((bytesRead = in.read(buffer)) != -1)
{
out.write(buffer, 0, bytesRead);
}
 
Veena Rani
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
out = new FileOutputStream(filePath);
The filePath is the path of the file on your local machine where you want to save file read from the blob column in the database.
Veena
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic