• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQL Server image datatype

 
Dan Eichler
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm a little newish to java, but really new to sql server and datatype image.

I am trying to extract files from the database and store them locally on the computer. I have retrieved the image contains from the column with rs.getBlob, and have saved them to the system with the following code:

BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(fileName));
bos.write(blob.getBytes( 1, (int) blob.length()), 0, (int) blob.length() );

This does save the file, but I can't open the file no matter what I change the extension to. The kicker is that I don't know what each file is suppose to be, the database does not contain the names of the files either.

 
Dan Eichler
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So it ended up being the way the data has been stored into the database. It's converted to another proprietary format. I have tested my code on another table in the database that has pdf's stored as blobs and those work fine.

Dan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic