oracle-databasestored-proceduresoracle11gora-24247

How to solve ORA-24247: network access denied by access control list (ACL) in Oracle stored procedure


I have an Oracle 11g stored procedure that takes a text address and returns latitude and longitude using a Google API. This procedure uses oracle's utl_http feature.

Reading the Oracle documentation on using this feature, I saw that it is necessary to create a wallet and bind a Google HTTPS URL certificate. Already did that.

I also have to create ACL resources, add privileges and assign ACL. Already did that.

But when I execute the procedure it always presents the error 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
...

My ACL commands

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;

Solution

  • The problem was wrong URL in host parameter in DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL block