File uploads in a non-Apex PL/SQL application migrated to ORDS

≡放荡痞女 提交于 2019-12-04 19:54:08

ORDS 18.3+ the logic changed to make it easier for non-apex. Here's the new logic in a flow chart hopefully make it easy to follow.

In Previous to 18.3 and below here's how to accomplish the same >

The catch is right now is there's a hacky workaround to getting this to work and that's to pretend apex is too old to use that code path. ( yeah yeah I'll fix this )

In the db user that is configured in the connection pool file, create this view. The code checks that if apex 4+ is installed to use that. This view is how that is checked so forcing ords to thing apex is old will make the plain 'ol DOC Table path be used.

create view apex_release as
  select '1.0.0.0' VERSION_NO from dual;

url-mapping.xml

<?xml version="1.0" encoding="UTF-8"?>
<pool-config xmlns="http://xmlns.oracle.com/apex/pool-config">
   <pool base-path="/klrice" name="klrice" />
</pool-config>

conf/klrice.xml

The parameter is named apex.docTable and this will default to "FLOWS_FILES.WWV_FLOW_FILE_OBJECTS$"

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
  <entry key="db.username">klrice</entry>
  <entry key="db.password">klrice</entry>
  <entry key="apex.docTable">klrice.MYDOCTABLE</entry>
</properties>

My Table

KLRICE@xe🍻🍺 >CREATE TABLE MYDOCTABLE (
  2    NAME               VARCHAR(256)   UNIQUE NOT NULL, 
  3    MIME_TYPE          VARCHAR(128), 
  4    DOC_SIZE           NUMBER, 
  5    DAD_CHARSET        VARCHAR(128), 
  6    LAST_UPDATED       DATE, 
  7    CONTENT_TYPE       VARCHAR(128), 
  8    CONTENT            LONG RAW, 
  9*   BLOB_CONTENT       BLOB );

After being called:

  1* select BLOB_CONTENT from MYDOCTABLE
KLRICE@xe🍻🍺 >/

BLOB_CONTENT                                                                    
--------------------------------------------------------------------------------
89504E470D0A1A0A0000000D49484452000000C8000000C80806000000AD58AE9E00000001735247
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!