我正在使用下面的代码通过 Oracle DB 触发器进行 http 调用
create or replace TRIGGER TEST_TABLE_TRIGGER
AFTER INSERT OR UPDATE OF VALUE ON TEST_TABLE
for each row
DECLARE
req utl_http.req;
res utl_http.resp;
buffer varchar2(4000);
url varchar2(4000) := 'http://localhost:8086/testMethod';
BEGIN
req := utl_http.begin_request(url, 'GET',' HTTP/1.1');
utl_http.set_header(req, 'content-type', 'application/json');
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;
DBA 团队已向 DB 用户授予 http 权限(SQL> grant execute on UTL_HTTP to userName;)。但是我的应用程序日志中出现以下错误(Springboot)
java.sql.SQLException: ORA-29273: HTTP request failed
ORA-12541: TNS:no listener
ORA-06512: at "SYS.UTL_HTTP", line 368
ORA-06512: at "SYS.UTL_HTTP", line 1118
ORA-06512: at "userName.TEST_TABLE_TRIGGER", line 9
ORA-04088: error during execution of trigger 'userName.TEST_TABLE_TRIGGER '
我尝试在 linux 服务器中运行应用程序并使用有效的 IP 地址而不是 localhost ( 'http://localhost:8086/testMethod'
) 并得到相同的错误。
当我询问 DBA 团队时,他们说数据库侦听器已启动并在端口1525和1791上运行。如何/在哪里使用数据库侦听器端口来使此代码工作?