aspose file tools*
The moose likes JDBC and the fly likes reading Blob without knowing the filename Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "reading Blob without knowing the filename" Watch "reading Blob without knowing the filename" New topic

reading Blob without knowing the filename

Janine Guenther

Joined: Aug 30, 2002
Posts: 3
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?
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 = != -1)
out.write(buffer, 0, bytesRead);
Veena Rani
Ranch Hand

Joined: Mar 09, 2000
Posts: 34
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.
It is sorta covered in the JavaRanch Style Guide.
subject: reading Blob without knowing the filename
Similar Threads
Sending a file over socket
file transfer over TCP problem
File download from Blob column does not work
opening a video file in a browser
getOutputStream() has already been called for this response