Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

http request failed

Chandler BingJan 8 2021 — edited Jan 8 2021

hello everyone,
I need little help on utl_htp. my requirement is capture weather information of current date, so i create a procedure that return all information through api weather bit as you seen below code:
create or replace NONEDITIONABLE procedure GET_WEATHER_DATA
( p_loc_code in varchar2,
p_loc_name in varchar2,
p_lat in varchar2,
p_long in varchar2
) is
req utl_http.req;
res utl_http.resp;
url varchar2(4000) := 'http://api.weatherbit.io/v2.0/current?&lat='||p_lat||'&lon='||p_long||'&key=7cffe6ab7f734aefb1a511a9d26ea520';
name varchar2(4000);
buffer varchar2(4000);
content varchar2(4000);
v_location varchar2(400);

begin
req := utl_http.begin_request(url, 'POST',' HTTP/1.1');
utl_http.set_header(req, 'user-agent', 'mozilla/4.0');
utl_http.set_header(req, 'content-type', 'application/json');
--utl_http.set_header(req, 'Content-Length', length(content));

utl_http.write_text(req,content);
res := utl_http.get_response(req);
-- process the response from the HTTP call
begin
loop
utl_http.read_line(res, buffer);
dbms_output.put_line(buffer);

end loop;
utl_http.end_response(res);

exception
when utl_http.end_of_body
then
utl_http.end_response(res);
end;
end GET_WEATHER_DATA;

I run this code from sys user and it will run perfectly in my local system and i m using database 12.2c
but the problem is that when i run this code on another machine that also have same database version this will show below error:
image_2021_01_05T11_57_57_583Z.pngI dont understand where is the problem.
and one more thinng in my local i dont create any acl then it will worked fine but in another system database i also created acl and give grant utl htp to sys this will show same error.
Can anyone help me?

Comments

cormaco

If you install Virtualbox on your MacBook, you can use this appliance to get an Oracle database:
Developer Day - Hands-on Database Application Development (oracle.com)

Billy Verreynne

Mac was supported years ago with 10g. Think that even RAC support was planned. (https://docs.oracle.com/cd/B19306_01/install.102/b25286.pdf)
As I heard things went south between Oracle and Apple, and the support for Mac was discontinued.

L. Fernigrini

There are no Mac version for Oracle Databases, but as cormaco mentioned you can easily use VirtualBox to have a VM with Linux (you can use Oracle Linux) and install Oracle 18c XE on it.
Or you can use the VM he already pointed, it has Oracle 19c pre installed, and you can add 18c XE if you need (if you just want to test or do some Proof of Concept, then using the 19c should be OK, if you want to use it for commercial / production then you need either a license or to use the free XE edition).

1 - 3

Post Details

Added on Jan 8 2021
6 comments
435 views