0
votes

I'm trying to do a REST/HTTP request from PL/SQL in OCI.

I am stumped when trying UTL_HTTP ( but successful using APEX_WEB_SERVICE package).

Has anyone had success using UTL_HTTP on OCI AutonomousDB?

BEGIN
    UTL_HTTP.SET_WALLET('');
    http_request := UTL_HTTP.begin_request(UTL_URL.Escape([url]), 'GET');
    http_response := UTL_HTTP.get_response(http_request);
    UTL_HTTP.read_text(http_response, return_text);
    DBMS_OUTPUT.put_line (return_text);
END;

Error report – ORA-01031: insufficient privileges ORA-06512: at "SYS.UTL_HTTP", line 136 ORA-06512: at "SYS.UTL_HTTP", line 1410
ORA-06512: at line 7
01031. 00000 - "insufficient privileges"
*Cause: An attempt was made to perform a database operation without the necessary privileges.
*Action: Ask your database administrator or designated security administrator to grant you the necessary privileges

I have setup ACL as follows so http privilege is granted:

BEGIN
   DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(
         host => '[domain]',
        lower_port => 443,
        upper_port => 443,
        ace =>  xs$ace_type(privilege_list => xs$name_list('http'),
                             principal_name => '[name]',
                             start_date => SYSTIMESTAMP,
                             principal_type => xs_acl.ptype_db));
END;
/
3
from the doc it must be https, so are you trying http or https?gsalem
Yes, it's a https - requiring SSL certificate. So I 'SET_Wallet' - expecting the Amazon root certificate to authenticate automatically from the cached certs?dam0

3 Answers

0
votes

Could you please review this Oracle documentation on this error. This might be useful OCI Autonomous DB ADMIN User Cannot GRANT On SYS Views, Getting ORA-1031 (Doc ID 2560070.1) Thanks, Anupam

0
votes

UTL_HTTP is unsupported on OCI Autonomous DB -

Oracle Database Features That Are Not Supported

The following Oracle Database features, options and packs are not supported in Autonomous Database.

UTL_SMTP, UTL_HTTP, and UTL_TCP PL/SQL packages


Now I know..

0
votes

Saying "UTL_HTTP is unsupported on OCI Autonomous DB" is misleading. First of all, you should clarify what flavor of ADB you are using. The doc link you referenced is for Autonomous Database on Dedicated Exadata Infrastructure (ADB-D). Autonomous Database on Shared Exadata Infrastructure (ADB-S) supports UTL_HTTP as already mentioned in the ADB-S doc.