为什么我的 Oracle Rest-Enabled SQL 参考未被识别?

发布于 2025-01-11 08:00:19 字数 1436 浏览 0 评论 0原文

和这个人吵了好几天了。希望我太厚重了,某处漏掉了一个分号。

我一直在尝试在本地机器上设置对启用 REST 的 SQL (RESS) 的引用,但 Apex 拒绝承认。

我正在使用 https://docs.oracle.com/database/apex-18.1/HTMDB/rest-enabled-sql-creating.htm#HTMDB-GUID-0906921E-AF79-49D4-B909-1C090F805D9D,其中看起来很简单。

在您询问之前:

  • 是的,我已经启用了 REST 架构
  • 是的,我已经在 defaults.xml 文件中启用了 RESS 输入图片此处描述
  • 是的,我已经使用像 curl -i -X POST --user testuser1:testuser1 --data-binary "select sysdate来自 Dual" -H "Content-Type: application/sql" -k http://localhost:8080/ords/hr2/_/sql ,它可以工作。

然后在 APEX->共享组件->数据源->REST Enabled SQL 中,我设置了此参考: RESS 参考

并且它使用这些凭据:

credendtials

但是,当我最初创建引用并对其进行测试时,我收到以下消息:

输入图像描述这里

我到底做错了什么? 使用 Oracle APEX 21.2.0 和 ORDS 版本 21.4.1.r0250904

Been fighting with this one for days. Hopefully, I'm being thick and there's a semicolon missing from somewhere.

I've been trying to setup a reference to my REST-enabled SQL (RESS) on my local box, and Apex refuses to acknowledge it.

I'm using the article at https://docs.oracle.com/database/apex-18.1/HTMDB/rest-enabled-sql-creating.htm#HTMDB-GUID-0906921E-AF79-49D4-B909-1C090F805D9D, which seems quite straightforward.

Before you ask:

  • Yes, I've enabled the schema for REST
  • Yes, I've enabled RESS in the defaults.xml file
    enter image description here
  • Yes, I've tested the RESS away from APEX, using a curl command like curl -i -X POST --user testuser1:testuser1 --data-binary "select sysdate from dual" -H "Content-Type: application/sql" -k http://localhost:8080/ords/hr2/_/sql, and it works.

Then in APEX->Shared Components->Data Sources->REST Enabled SQL, I've setup this reference:
RESS reference

and it uses these credentials:

credendtials

However, when I initially created the reference, and when I test it, I get the following message:

enter image description here

What on earth am I doing wrong?
Using Oracle APEX 21.2.0 and ORDS Version 21.4.1.r0250904

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不及他 2025-01-18 08:00:19

屏幕截图看起来不错。我现在将检查数据库是否可以通过 APEX_WEB_SERVICE 到达 ORDS 端点,如下所示(您可以使用 SQL*Plus 或 SQL Workshop 来实现此目的):

declare
    l_result clob;
begin
    apex_web_service.set_request_headers(
        p_name_01   => 'Content-Type', 
        p_value_01  => 'application/sql' );

    l_result := apex_web_service.make_rest_request(
                    p_url         => 'http://localhost:8080/ords/hr2/_/sql',
                    p_http_method => 'POST',
                    p_username    => 'TESTUSER1',
                    p_password    => 'testuser1',
                    p_body        => 'select sysdate from dual' );

    dbms_output.put_line( l_result );
end;

可能的错误是...

  • PL/SQL 网络未为 APEX_XXXXXX 用户设置 ACL
  • 数据库已定义代理服务器,该代理服务器无效

the screen shots look good. I would now check whether the database can reach the ORDS endpoint with APEX_WEB_SERVICE, as follows (you can use either SQL*Plus or SQL Workshop for this):

declare
    l_result clob;
begin
    apex_web_service.set_request_headers(
        p_name_01   => 'Content-Type', 
        p_value_01  => 'application/sql' );

    l_result := apex_web_service.make_rest_request(
                    p_url         => 'http://localhost:8080/ords/hr2/_/sql',
                    p_http_method => 'POST',
                    p_username    => 'TESTUSER1',
                    p_password    => 'testuser1',
                    p_body        => 'select sysdate from dual' );

    dbms_output.put_line( l_result );
end;

Possible errors are ...

  • the PL/SQL Network ACL was not set up for the APEX_XXXXXX user
  • the database has a proxy server defined, which is not valid
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文