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


  1. Hi,
    I am using the same method to get PDF document from DB.
    My query is
    select cd.blob_content,, '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?


    1. Hello Veerendra,

      As 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

      Jaydip Bosamiya


Post a Comment

My photo
Jaydip Bosamiya
I am Oracle APEX Consultant, Blogger and Integrator. All-rounder in building small, medium and enterprise applications. Extensive knowledge in various area of web-driven applications in Back-end (PL/SQL, SQL, Java), Front-end (Oracle APEX, HTML, JavaScript, CSS, jQuery, OracleJET, ReactJS), RESTful APIs, Third-party library integrations (Apex Office Print (AOP), Payment Gateways, Syncfusion, HighCharts) and APEX Plugins (HighChart, StarRating)

Popular posts from this blog

Oracle APEX - Interactive Report - Scrollbars on Top

How to create your own customized nested report regions using jQuery

Make your RESTful APIs Secured with OAuth2 - Basic, Simple and Easy Steps