Create RESTful web service to download BLOB content
I have been using RESTful API to download BLOB content as a file. This is very useful in many places where you want to give your BLOB document as a source to URL. This can be used within Oracle APEX or outside Oracle APEX.
Following are the steps to create RESTful web service using Media Resource type to make your BLOB document downloadable.
Use following link as a live demo, which will return product image for product_id = 1.
Hope this helps.
Jaydip Bosamiya
jbosamiya@gmail.com
Following are the steps to create RESTful web service using Media Resource type to make your BLOB document downloadable.
Use following link as a live demo, which will return product image for product_id = 1.
Hope this helps.
Jaydip Bosamiya
jbosamiya@gmail.com
Hi,
ReplyDeleteI am using the same method to get PDF document from DB.
My query is
select cd.blob_content, cd.name, 'application/pdf' mimetype
from my_table cd
where cd.document_id = :id
However, I get
500 Internal Server Error
The request could not be processed because an error occurred whilst attempting to evaluate the SQL statement associated with this resource. Please check the SQL statement is correctly formed and executes without error. SQL Error Code: Invalid column type: getString/getNString not implemented for class oracle.jdbc.driver.T4CBlobAccessor, Error Message: {2}.
Any ideas to solve this please?
Thanks
Hello Veerendra,
DeleteAs per error message, it looks like the either sql statement has some error or is not in expecting format.
Did you tried by rewriting your query as following columns sequence?
select 'application/pdf' mimetype, cd.blob_content
from my_table cd
where cd.document_id = :id
Regards,
Jaydip Bosamiya