• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reading blob and displaying the word document

 
vjy chin
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I just started using blob. I have gone through many tutorials and forums, but I am not able to make my application work.

I need to retrieve value from blob field in Oracle database. I need to convert that into a byte array. I need to pass that to another class. I need to use this byte array to print a part of document. (The document has many sections, and this blob text is one of the sections).

The blob field is a word document and I do not know what encoding is done for it. BTW, is this necessary information, should I need to look at the encoding, if so what encoding is done for word document.



For this, the output I am getting is junk with some text. But the text is like A,s,d,f,g,h,j,k. I am not sure if this is right.

I also tried



Any help in this would be greatly appreciated.

Thanks

[ January 04, 2007: Message edited by: vjy chin ]
[ January 11, 2007: Message edited by: vjy chin ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can just call rs.getBytes() to get a byte array for a BLOB. No need to write the logic yourself when it is in the driver.

If you print the output, it should look like junk because it is binary day. Try writing the byte array to a file called "temp.doc". Then open it in Word to validate it is a good document.
 
vjy chin
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.

Actually I need to write the binary word document into another rtf document (the master document).

I need to create a rtf document with several parts. One such part will contain some instructions. This instructions itself is a word document and it should be stored in BLOB field in Oracle.

What I am doing is, I am having a service class where I get all data including instructions data. I am passing instructions data as byte [].(Is there any other better way to pass this? ). I am getting all the info in documentGeneration class. I am appending all the data including the instructions. Then I need to display this Master document which includes the instructions.

Also none of these classes are servlets. SO how can I encode the instructions properly to attach into the Master document. Is there anyway to do it.

Any suggestions for this welcome.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic