2
votes

I have the following error message when I try to establish a HTTP request connection:

ORA-29273: HTTP request failed ORA-06512: at "SYS.UTL_HTTP", line 1029 ORA-12545: Connect failed because target host or object does not exist ORA-06512: at line 10 .

Line 10 is the following:

req := UTL_HTTP.BEGIN_REQUEST('oracle.com'); 

Here is my pl/sql block:

DECLARE 
    req UTL_HTTP.REQ; 
    resp UTL_HTTP.RESP; 
    name_1 VARCHAR2(256); 
    value_1 VARCHAR2(1024); 
    v_msg VARCHAR2 (500);

BEGIN 
    req := UTL_HTTP.BEGIN_REQUEST('http://www.oracle.com'); 
    UTL_HTTP.SET_HEADER(req, 'User-Agent', 'Mozilla/5.0'); 
    UTL_HTTP.SET_FOLLOW_REDIRECT(req, 0); 
    resp := UTL_HTTP.GET_RESPONSE(req); 
    LOOP
        Utl_Http.read_text (resp, v_msg);
        DBMS_OUTPUT.put_line (v_msg);
    END LOOP;

    UTL_HTTP.END_RESPONSE(resp);
EXCEPTION
    WHEN Utl_Http.end_of_body
        THEN
        NULL; 
END;
1
That code works. Are you sure you can resolve that domain name from that machine with your Oracle user?Mat
how can i solve this err NO , it seems no <code> ORA-29273: HTTP request failed ORA-06512: at "SYS.UTL_HTTP", line 1029 ORA-12545: Connect failed because target host or object does </code>Shaban Mousa
If you can't resolve the domain, or connect to that URL from the Oracle server's user account, you can't "solve" this error. You need to find out why you can't resolve that address or connect to that host - and this has nothing to do with Oracle (or programming).Mat
unfortunately, I'm new to oracle world , I knowly only pl/sql .Shaban Mousa
Once more: this error is not an error with the pl/sql code.Mat

1 Answers

0
votes

the code seems fine to me...

the reason of this error is outside the code you show:

The system this code is run on (the DB server) must be able to resolve the domain name - which has nothing to do with Oracle...

To solve this you need to setup DNS / hosts correctly on the machine / in the OS!