oracle ORA-12545:连接失败,因为目标主机或对象不存在 ORA-06512
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8463261/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ORA-12545: Connect failed because target host or object does not exist ORA-06512
提问by Shaban Mousa
I have the following error message when I try to establish a HTTP request connection:
当我尝试建立 HTTP 请求连接时,我收到以下错误消息:
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 .
ORA-29273:HTTP 请求失败 ORA-06512:在“SYS.UTL_HTTP”,第 1029 行 ORA-12545:连接失败,因为目标主机或对象不存在 ORA-06512:在第 10 行。
Line 10 is the following:
第 10 行如下:
req := UTL_HTTP.BEGIN_REQUEST('oracle.com');
Here is my pl/sql block:
这是我的 pl/sql 块:
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;
回答by Yahia
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...
运行此代码的系统(数据库服务器)必须能够解析域名 - 这与 Oracle 无关......
To solve this you need to setup DNS / hosts correctly on the machine / in the OS!
要解决这个问题,您需要在机器上/操作系统中正确设置 DNS/主机!