标签:
--1 创建 ACL
begin
dbms_network_acl_admin.create_acl( acl => ‘temp_acl.xml‘,
description =>‘Normal Access‘,
principal=>‘CONNECT‘,
is_grant => true,
privilege=>‘connect‘,
start_date=> null,
end_date => null);
end;
--2. 确认acl已经生成
SELECT any_path FROM resource_view WHERE any_path like ‘%temp_acl%‘;
--3 为 ACL 增加一个权限
begin
dbms_network_acl_admin.add_privilege(
acl => ‘temp_acl.xml‘,
principal => ‘BJHYFP‘, --可以使用该acl的用户
is_grant => TRUE,
privilege => ‘connect‘,
start_date => null,
end_date => null);
end;
--4 分配将受该 ACL 制约的主机以及其他详细信息
begin
dbms_network_acl_admin.assign_acl(
acl => ‘temp_acl.xml‘,
host => ‘192.168.0.189‘,
lower_port => null,
upper_port => null);
end;
--5 使用示例
declare
url varchar2(200) := ‘http://192.168.0.189:8888/oraclehttp/servlet/orhttp?a=12‘;
req utl_http.req;
resp utl_http.resp;
value varchar2(2000);
begin
req := utl_http.begin_request(url);
resp := utl_http.get_response(req);
loop
utl_http.read_line(resp, value, TRUE);
dbms_output.put_line(value);
dbms_output.put_line(‘网站回复‘ || value);
end loop;
utl_http.end_response(resp);
EXCEPTION
WHEN utl_http.end_of_body THEN
utl_http.end_response(resp);
end;
标签:
原文地址:http://www.cnblogs.com/iyoume2008/p/5266629.html