0

I use the apex oracle, I have an api (post), with the help of which I write a photo in my database oracle, but I want to go through a bit, I want the photo that comes to me immediately sent to the base of the mongoDB, not writing in my database is it possible to do this ??? , I will be grateful for your help

v_blob blob := p_blob; 
v_clob          CLOB; 
json_table      apex_json.t_values; 
v_event_id      varchar2(300); 

V_SNAPSHOT      blob; 
json_lob        clob; 
v_id            NUMBER; 
  
BEGIN 
   
  v_clob := iot_general.BLOB_TO_CLOB(v_blob); 
  apex_json.parse(json_table, v_clob); 
   
  v_event_id  := apex_json.get_varchar2(p_path => 'event.id', p_values => json_table); 
  V_JSON64   := apex_json.get_clob (p_values => json_table, p_path => 'snapshot', p0 => 3); 
  V_SNAPSHOT := iot_general.clob_base64_to_blob (p_clob => V_JSON64); 
   
  INSERT INTO IOT_TELEMETRY_SNAPSHOTS 
          (EVENT_ID, MYFILE) 
  VALUES 
        (v_event_id,V_SNAPSHOT) 
i see it like this .I have 2 columns in the database, snapshots and event ids, but I don't know how I need to write down the data

v_blob blob := p_blob; 
v_clob          CLOB; 
json_table      apex_json.t_values; 
v_event_id      varchar2(300); 

V_SNAPSHOT      blob; 
json_lob        clob; 
v_id            NUMBER; 
  
BEGIN 
   
  v_clob := iot_general.BLOB_TO_CLOB(v_blob); 
  apex_json.parse(json_table, v_clob); 
   
  v_event_id  := apex_json.get_varchar2(p_path => 'event.id', p_values => json_table); 
  V_JSON64   := apex_json.get_clob (p_values => json_table, p_path => 'snapshot', p0 => 3); 
  V_SNAPSHOT := iot_general.clob_base64_to_blob (p_clob => V_JSON64); 
  if  V_JSON64   is not null
      then

      apex_web_service.g_request_headers(1).name := 'Content-Type';
      apex_web_service.g_request_headers(1).value := 'application/x-www-form-urlencoded'; 

       l_clob_post := apex_web_service.make_rest_request(
        p_url => 'http://myMachine/myService',
        p_http_method => 'POST',
        p_parm_name => apex_util.string_to_table('param1:param2'),
        p_parm_value => apex_util.string_to_table('xyz:xml'));

        
  end if     
        
        
Apex_MAN
  • 107
  • 3
  • 10
  • See https://stackoverflow.com/questions/42085147/can-i-store-binary-string-in-clob-column/42086105#42086105 – Wernfried Domscheit Mar 22 '20 at 13:12
  • @WernfriedDomscheit convert is not a problem, i want to write the data into a mongo table, do you understand what i want ?? – Apex_MAN Mar 22 '20 at 13:59
  • 1
    I don't think you can connect to a MongoDB from Oracle directly, however the [MongoDB ODBC Driver](https://www.mongodb.com/blog/post/odbc-driver-for-the-mongodb-connector-for-business-intelligence) may work in conjunction with the [Oracle Database Gateway for ODBC](https://docs.oracle.com/cd/B28359_01/gateways.111/b31043/installodbc.htm#BHCEJHFE). Otherwise you have to develop a layer in between, e.g. with php, Java, etc. – Wernfried Domscheit Mar 22 '20 at 14:10
  • @WernfriedDomscheit that is, i won't be able to write data directly to mongo db? – Apex_MAN Mar 22 '20 at 14:28
  • @WernfriedDomscheit my mongo and apex are installed on the same server – Apex_MAN Mar 22 '20 at 14:32
  • 2
    Doesn't matter where the mongoDB is located. Apex is implemented totally as oracle PL/SQL procedures ... procedures that run entirely within the oracle database. The oracle gateway _is_ the way that processes within the oracle database communicate with non-oracle databases. Any process that communicates with any database is a client to that database. In this case the oracle database is acting as a client to the Mongo, and that is done via the gateway. – EdStevens Mar 22 '20 at 15:32

0 Answers0