我正在尝试发出请求https主机,在编写下面的PL / SQL块之前是我的工作。
我以sysdba
连接到DB grant execute on utl_http to <user>;
我跑到脚本下面
SET SERVEROUTPUT ON;
BEGIN
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL
(
ACL => 'oraclecloud_wallet.xml',
DESCRIPTION => 'Permissions to access https://XXXX.oraclecloud.com',
PRINCIPAL => 'SWIFT_LOCAL',
IS_GRANT => TRUE,
PRIVILEGE => 'connect',
START_DATE => NULL,
END_DATE => NULL
);
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE
(
ACL => 'oraclecloud_wallet.xml',
PRINCIPAL => 'SWIFT_LOCAL',
IS_GRANT => true,
PRIVILEGE => 'resolve'
);
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL
(
ACL => 'oraclecloud_wallet.xml',
HOST => '*.oraclecloud.com'
);
DBMS_NETWORK_ACL_ADMIN.ASSIGN_WALLET_ACL
(
ACL => 'oraclecloud_wallet.xml',
WALLET_PATH => 'file:C:\app\wallet'
);
COMMIT;
EXCEPTION WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Error occurred while creating ACL: '|| SQLERRM);
END;
/
我下载了证书并保存在本地文件夹C:\ app \ wallet。
我通过CREATE OR REPLACE DIRECTORY CER_DIR AS 'C:\app\wallet';
然后我在PL / SQL块下面运行
set SERVEROUTPUT on;
DECLARE
lo_req UTL_HTTP.req;
lo_resp UTL_HTTP.resp;
BEGIN
UTL_HTTP.SET_WALLET ('file:C:\app\wallet');
lo_req := UTL_HTTP.begin_request('https://XXXX.oraclecloud.com');
lo_resp := UTL_HTTP.get_response(lo_req);
dbms_output.put_line(lo_resp.status_code);
UTL_HTTP.end_response(lo_resp);
END;
现在我收到了以下错误
Error report -
ORA-29273: HTTP request failed
ORA-06512: at "SYS.UTL_HTTP", line 1130
ORA-28759: failure to open file
ORA-06512: at line 6
29273. 00000 - "HTTP request failed"
*Cause: The UTL_HTTP package failed to execute the HTTP request.
*Action: Use get_detailed_sqlerrm to check the detailed error message.
Fix the error and retry the HTTP request.
谁能告诉我哪里出错了。这将是很大的帮助。