File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

loading Oracle BLOBs and CLOBs

 
achana chan
Ranch Hand
Posts: 277
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Again.
I would like to load the objects stored in an Oracle BLOB or CLOB datatype and display them on the browser along with the information related to the item.
These BLOBs and CLOBs and be almost any docflavour eg .jpg, .html, .pdf, .gif etc
In Zukowski, there was talk of using awt's "getImage(fileName)".
Most suggest extending either JFrame (implementing ImageObserver) or ExitableJFrame
Is there a recommended way to go about this ???
THX
 
achana chan
Ranch Hand
Posts: 277
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wouldn't like to use something not portable eg.
public void readBlob(int idVal)
{ Oracle.sql.BLOB myBlob = null; // not portable
#sql { select blobcol into :myBlob
from myBlobTable
where id = :idVal };
...
etc
It seems to be that using non-portable constructs defeats my purpose and the reason for migrating to JAVA in the first instance...
 
achana chan
Ranch Hand
Posts: 277
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi !
Just in case anyone read this and is willing to comment on it...
I have one BLOB and one CLOB column in the same record.
I have been able to stream documents into and out of the BLOB's incl. MS .doc Also I have been able to get the content from BLOB and write it to a target directory.
However I am having odd problems with CLOB, a simple text file. My servlet attempts to read the CLOB and does create the output file in the target directory, but does not copy the content over. It also returns 0 for clobLength !?! Here is the stub-code :
...

...
Since the clobLength is 0, obviously it will not copy from the database CLOB to the file.
Manually change the clobLength = 8132, recompile and run, then it copies some junk to the targetFile, certainly not the textual data in the CLOB itself.
The BLOB is fine...
Can someone comment on this please and if possible, give me a hint on where I might have gone wrong with a simple text file ???
and
 
achana chan
Ranch Hand
Posts: 277
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All.
Just in case someone might have read this : thanks I figured out the error with the CLOB textfile.
However I would love to have your comment on how to display the BLOB on the browser...
THX
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic