Forum OpenACS Q&A: How to write blob to a file

Collapse
Posted by XD Shao on
I have many graphics stored in the Oracle as blob and use "ns_ora write_blob" for return the graphics to web request. Some of them get a lot of hits, so instead of hitting the database for every request, it probably make sense to save the blob to a file in the file system on 1st request and then use "ns_writefp" to return the file for any subsequential request.

The question is how do I retrieve a blob from Oracle and write to a file in AOLServer ?

Collapse
Posted by Derick Leony on
I've seen this in the CR publish procs:

db_blob_get_file wmb_get_blob_file "
select content from cr_revisions where revision_id = $revision_id
" -file $filename

Maybe a long term solution for your problem could be to take out all of your images to the file system. HTH.