Difference between revisions of "Wallet / ACL / Network Access"
From dbawiki
| Line 1: | Line 1: | ||
| + | Nice, clear example found on [https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:9526497800346930725 AskTOM] | ||
===Create a wallet=== | ===Create a wallet=== | ||
| − | |||
| − | |||
<pre> | <pre> | ||
mkdir /home/oracle/wallet | mkdir /home/oracle/wallet | ||
Revision as of 08:50, 23 May 2017
Nice, clear example found on AskTOM
Contents
Create a wallet
mkdir /home/oracle/wallet orapki wallet create -wallet /home/oracle/wallet -pwd MyWallePassword999 -auto_login orapki wallet add -wallet /home/oracle/wallet -trusted_cert -cert /tmp/cert1.cer -pwd MyWallePassword999 orapki wallet add -wallet /home/oracle/wallet -trusted_cert -cert /tmp/cert2.cer -pwd MyWallePassword999 orapki wallet add -wallet /home/oracle/wallet -trusted_cert -cert /tmp/cert3.cer -pwd MyWallePassword999
Create an ACL
begin
dbms_network_acl_admin.create_acl ( acl => 'utl_http.xml'
, description => 'my acl'
, principal => 'MCDONAC'
, is_grant => TRUE
, privilege => 'connect'
, start_date => null
, end_date => null
);
commit;
end;
/
Add privilege to ACL
begin
dbms_network_acl_admin.add_privilege ( acl => 'utl_http.xml'
, principal => 'MCDONAC'
, is_grant => false
, privilege => 'connect'
, position => null
, start_date => null
, end_date => null
);
commit;
end;
/
Open the wallet and use UTL_HTTP to retrieve a web page
set serverout on
declare
l_url varchar2(100) := 'https://www.litle.com/';
l_req utl_http.req;
l_result utl_http.resp;
l_data varchar2(32767);
begin
utl_http.set_wallet('file:/home/oracle/wallet', 'MyWallePassword999');
l_req := utl_http.begin_request(l_url);
l_result := utl_http.get_response(l_req);
begin
loop
utl_http.read_text(l_result, l_data, 1000);
dbms_output.put_line (l_data);
end loop;
exception
when utl_http.end_of_body then
utl_http.end_response(l_result);
end;
end;
/