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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "reading Blob without knowing the filename" Watch "reading Blob without knowing the filename" New topic
Author

reading Blob without knowing the filename

Janine Guenther
Greenhorn

Joined: Aug 30, 2002
Posts: 3
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

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.
Veena
 
 
subject: reading Blob without knowing the filename