我有一个Oracle 11g存储过程,该过程使用文本地址并使用Google API返回纬度和经度。此过程使用oracle的utl_http功能。
在阅读有关使用此功能的Oracle文档时,我发现有必要创建一个钱包并绑定Google HTTPS URL证书。已经做到了。
我还必须创建ACL资源,添加权限并分配ACL。已经做到了。
但是当我执行该过程时,它始终会显示错误ORA-24247
create or replace procedure test_procedure(p_address IN VARCHAR2, p_lat out number, p_long out number) is
l_http_request UTL_HTTP.req;
...
begin
l_address := REPLACE(TRIM('TRAV. JOAQUIM A. SILVA, 286 - ALVORADA - GUANHÃES/MG CEP: 39740-000'), ' ', '+');
...
UTL_HTTP.set_wallet('file:/MY_ORACLE_HOME/admin/MY_SCHEMA/wallet', NULL);
l_request := 'https://maps.googleapis.com/maps/api/geocode/json?address=' ||
l_address || chr(38) || 'language=pt-BR'||'&key=MyGoogleKey';
l_http_request := utl_http.begin_request(l_request,'GET','HTTP/1.1'); -- this line presents ORA-24247 error
...
我的ACL命令
begin
DBMS_NETWORK_ACL_ADMIN.create_acl(
acl => 'www_google.xml',
description => 'Google Maps Access',
principal => 'MY_DB_USER',
is_grant => TRUE,
privilege => 'connect',
start_date => NULL,
end_date => NULL
);
dbms_network_acl_admin.add_privilege (
acl => 'www_google.xml',
principal => 'MY_DB_USER',
is_grant => TRUE,
privilege => 'connect',
start_date => null,
end_date => null
);
dbms_network_acl_admin.add_privilege (
acl => 'www_google.xml',
principal => 'MY_DB_USER',
is_grant => TRUE,
privilege => 'resolve',
start_date => null,
end_date => null
);
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL (
acl => 'www_google.xml',
host => '*.google.com',
lower_port => 25,
upper_port => 8080
);
end;
答案 0 :(得分:0)
问题是DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL块中主机参数中的URL错误