• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to retrieve blob data in java

 
suresh venkat
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Currently the blob data in the table has text data (I think the data is in binary format) , can somone pls provide a sample code to retrieve blob data in text format.
 
Scott Selikoff
author
Saloon Keeper
Posts: 4033
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I haven't compiled this code and run it, but it seems like it should work. The blob gets dumped to the string total.
[ January 17, 2006: Message edited by: Scott Selikoff ]
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's also a CLOB type, just for this sort of thing.

Scott's code looks good, but if I could add one suggestion: find out the encoding used to turn text into binary in the first place and supply it to the InputStreamReader. Better safe than sorry:
 
payal agrawal
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the URL below:

How to store/retrieve image to/from SQLServer
http://www.java-tips.org/content/view/203/29/

How to store/retrieve PDF document to/from SQLServer
http://www.java-tips.org/content/view/845/29/

Here the column "data" has datatype of BLOB. You can save word document/image in form of BLOB data in database.
 
suresh venkat
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Everybody , thanks for you response and the above solutions worked.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic