Oracle APEX 安装Oracle REST Data Services (ORDS) 教程

2024-02-14 15:58

本文主要是介绍Oracle APEX 安装Oracle REST Data Services (ORDS) 教程,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1- Introduction

Tài liệu được viết dựa trên:
  • Oracle 11g, 12c

  • ORDS 3.x

2- What is Oracle REST Data Services?

Oracle REST Data Services (ORDS)  is a data service which is used to replace Oracle HTTP server and mod_plsql. It bases on Java EE that provides RESTful service and increases security capability. it can deploy on WebLogic, Tomcat, Glassfish  or independently.

3- Interaction between Oracle and Oracle APEX ORDS

Normally, there are two ways to install  Oracle APEX. 

Method 1:
 Configure the  Embedded PL/SQL Gateway: This is the way to configure  Oracle APEX which   can run on  Oracle XML DB HTTP Server, it is a HTTP that is available when you install Oracle 11g or higher. 

Method 2: Install  Oracle APEX on a specific web server such as  WebLogic, Tomcat or Glassfish, ... 

Link worked with Oracle APEX as followed:
  • http://your-server:8080/apex
To use  RESTful services, you need to install   Oracle ORDS which can deploy on WebLogic Server, Tomcat, Glassfish,.. or independently. Oracle ORDS can read directly to Oracle APEX and replace completely Oracle HTTP Server, therefore you can use   RESTful on APEX and new URL to work with   Oracle APEX.
  • http://your-server:8080/ords

4- Download Oracle ORDS

You can download Oracle ORDS at:
  • http://www.oracle.com/technetwork/developer-tools/rest-data-services/downloads/index.html
Download results:

5- Config ORDS for APEX

CD to apex home directory.
Login to  sqlplus as sysdba.
Run the command to configure REST Service.
?
1
2
3
4
-- Configuring REST Service.
@apex_rest_config.sql
Sau khi lệnh trên thực thi thành công, 2 user APEX_LISTENER và APEX_REST_PUBLIC_USER đã được tạo ra.
  1. APEX_LISTENER - The account used to query RESTful Services definitions stored in Oracle Application Express.
  2. APEX_REST_PUBLIC_USER - The account used when calling RESTful Services definitions stored in Oracle Application Express.

Enable Network Services

By default, Network Services are disable in Oracle 11g or the newer version. Therefore, you must use the package of DBMS_NETWORK_ACL_ADMIN in order to to grant connect privileges to any host for the  APEX_050000 database user
You need to query to view the APEX users in the database:
?
1
Select Username from All_Users where username like 'APEX%' ;
Run command to grant connect privileges to any host for the APEX_050000 database user.
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Declare
    Acl_Path Varchar2(4000);
Begin
    -- Look for the ACL currently assigned to '*' and give APEX_050000
    -- the "connect" privilege if APEX_050000 does not have the privilege yet.
    Select Acl
    Into   Acl_Path
    From   Dba_Network_Acls
    Where  Host = '*'
    And    Lower_Port Is Null
    And    Upper_Port Is Null ;
    If Dbms_Network_Acl_Admin.Check_Privilege(Acl_Path
                                             , 'APEX_050000'
                                             , 'connect' ) Is Null Then
       Dbms_Network_Acl_Admin.Add_Privilege(Acl_Path
                                           , 'APEX_050000'
                                           , True
                                           , 'connect' );
    End If;
Exception
    -- When no ACL has been assigned to '*'.
    When No_Data_Found Then
       Dbms_Network_Acl_Admin.Create_Acl( 'power_users.xml'
                                        , 'ACL that lets power users to connect to everywhere'
                                        , 'APEX_050000'
                                        , True
                                        , 'connect' );
       Dbms_Network_Acl_Admin.Assign_Acl( 'power_users.xml'
                                        , '*' );
End ;
/
Commit ;

Grant connect for APEX_050000 user (If database is Oracle 11g):

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Declare
    Acl_Path Varchar2(4000);
Begin
    -- Look for the ACL currently assigned to '*' and give APEX_050000
    -- the "connect" privilege if APEX_050000
    --does not have the privilege yet.
    Select Acl
    Into   Acl_Path
    From   Dba_Network_Acls
    Where  Host = '*'
    And    Lower_Port Is Null
    And    Upper_Port Is Null ;
    If Dbms_Network_Acl_Admin.Check_Privilege(Acl_Path
                                             , 'APEX_050000'
                                             , 'connect' ) Is Null Then
       Dbms_Network_Acl_Admin.Add_Privilege(Acl_Path
                                           , 'APEX_050000'
                                           , True
                                           , 'connect' );
    End If;
Exception
    -- When no ACL has been assigned to '*'.
    When No_Data_Found Then
       Dbms_Network_Acl_Admin.Create_Acl( 'power_users.xml'
                                        , 'ACL that lets power users to connect to everywhere'
                                        , 'APEX_050000'
                                        , True
                                        , 'connect' );
       Dbms_Network_Acl_Admin.Assign_Acl( 'power_users.xml'
                                        , '*' );
End ;
/
Commit ;

Grant connect for APEX_050000 user (If database is Oracle 12c):

Procedures CREATE_ACL, ASSIGN_ACL, ADD_PRIVILEGE and CHECK_PRIVILEGE in DBMS_NETWORK_ACL_ADMIN are deprecated in Oracle Database 12c. Oracle recommends using APPEND_HOST_ACE instead.
?
1
2
3
4
5
6
7
8
9
10
-- Sử dụng cho Oracle 12c.
BEGIN
     DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(
         host => '*' ,
         ace => xs$ace_type(privilege_list => xs$name_list( 'connect' ),
                            principal_name => 'APEX_050000' ,
                            principal_type => xs_acl.ptype_db));
END ;
/

6- Deploying ORDS

Note: you must sure that you have installed Jave version 7 or higher and declare PATH variable. You can see how to install Java at:
  • Installing and Configuring Java
Add the path to bin folder of Java at the end of PATH
  • ;C:\DevPrograms\Java\jdk1.8.0_65\bin
Unzip the file  ord - **. zip that you have downloaded to a folder
You can see that in the folder unzipped have  ords.war file
Copy   images folder in apex to ords folder:
Now, we will install   Oracle ORDS independently (It is not necessary to deploy on Weblogic, Tomcat or other web server)
CD to ords folder:
Next, login sqlplus as sysdba.
Your  Oracle APEX is running on  Oracle XML DB  HTTP Server, you should disable it with the command:
?
1
2
3
4
5
6
7
8
--  Disable Oracle APEX on Oracle XML DB HTTP Server.
EXEC DBMS_XDB.SETHTTPPORT(0);
-- Note: You can enable it with command:
EXEC DBMS_XDB.SETHTTPPORT(8080)
Exit  sqlplus. And CD to ords:
Run command:
?
1
2
3
4
5
6
7
# Run command:
java -jar ords.war
# Or:
java -jar ords.war install
Enter the address of the machine that contains the database (default is localhost):
Port of database (Default is 1521):
Enter Service Name or SID of database:
Enter password for ORDS_PUBLIC_USER
Sqlplus requests to re-enter the user database information with sysdba rights. (Enter sys and then password).
SQLPlus will ask whether you use  Oracle APEX or not, if yes let's enter 1, then press "enter" to continue.
Entering a password for user will be created  (APEX_PUBLIC_USER):
Next, enter 1 to specify password for 2 newly created  user database (APEX_LISTENER, APEX_REST_PUBLIC_USER).
Select 1 to start ORDS in standalone mode:
You have configured ORDS successfully. Close CMD window

Running ORDS

Note: You can run the command below to see the help:
?
1
java -jar ords.war help standalone
CD to ORDS folder and run command:
?
1
java -jar ords.war standalone --port 8080 --apex-images C:/DevPrograms/ords/images
For the 1st time, it will ask where to place configure file:
ORDS has been successfully deployed.
Note: If you receive an error:
Unlock for APEX_PUBLIC_USER user
?
1
2
3
4
5
6
7
8
Column username format a25;
Column account_status format a25;
-- Query unlocked APEX user.
select username,account_status from dba_users
  where lock_date is not null
  and username like 'APEX%' ;
?
1
Alter user APEX_PUBLIC_USER account unlock;
The configure file is also created after you deployed ORDS:
Don't close the window above, you can use APEX with new url:
  • http://localhost:8080/ords

这篇关于Oracle APEX 安装Oracle REST Data Services (ORDS) 教程的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/708951

相关文章

SpringBoot集成redisson实现延时队列教程

《SpringBoot集成redisson实现延时队列教程》文章介绍了使用Redisson实现延迟队列的完整步骤,包括依赖导入、Redis配置、工具类封装、业务枚举定义、执行器实现、Bean创建、消费... 目录1、先给项目导入Redisson依赖2、配置redis3、创建 RedissonConfig 配

oracle 11g导入\导出(expdp impdp)之导入过程

《oracle11g导入导出(expdpimpdp)之导入过程》导出需使用SEC.DMP格式,无分号;建立expdir目录(E:/exp)并确保存在;导入在cmd下执行,需sys用户权限;若需修... 目录准备文件导入(impdp)1、建立directory2、导入语句 3、更改密码总结上一个环节,我们讲了

RabbitMQ 延时队列插件安装与使用示例详解(基于 Delayed Message Plugin)

《RabbitMQ延时队列插件安装与使用示例详解(基于DelayedMessagePlugin)》本文详解RabbitMQ通过安装rabbitmq_delayed_message_exchan... 目录 一、什么是 RabbitMQ 延时队列? 二、安装前准备✅ RabbitMQ 环境要求 三、安装延时队

基于C#实现PDF转图片的详细教程

《基于C#实现PDF转图片的详细教程》在数字化办公场景中,PDF文件的可视化处理需求日益增长,本文将围绕Spire.PDFfor.NET这一工具,详解如何通过C#将PDF转换为JPG、PNG等主流图片... 目录引言一、组件部署二、快速入门:PDF 转图片的核心 C# 代码三、分辨率设置 - 清晰度的决定因

linux系统上安装JDK8全过程

《linux系统上安装JDK8全过程》文章介绍安装JDK的必要性及Linux下JDK8的安装步骤,包括卸载旧版本、下载解压、配置环境变量等,强调开发需JDK,运行可选JRE,现JDK已集成JRE... 目录为什么要安装jdk?1.查看linux系统是否有自带的jdk:2.下载jdk压缩包2.解压3.配置环境

Java Scanner类解析与实战教程

《JavaScanner类解析与实战教程》JavaScanner类(java.util包)是文本输入解析工具,支持基本类型和字符串读取,基于Readable接口与正则分隔符实现,适用于控制台、文件输... 目录一、核心设计与工作原理1.底层依赖2.解析机制A.核心逻辑基于分隔符(delimiter)和模式匹

spring AMQP代码生成rabbitmq的exchange and queue教程

《springAMQP代码生成rabbitmq的exchangeandqueue教程》使用SpringAMQP代码直接创建RabbitMQexchange和queue,并确保绑定关系自动成立,简... 目录spring AMQP代码生成rabbitmq的exchange and 编程queue执行结果总结s

Python库 Django 的简介、安装、用法入门教程

《Python库Django的简介、安装、用法入门教程》Django是Python最流行的Web框架之一,它帮助开发者快速、高效地构建功能强大的Web应用程序,接下来我们将从简介、安装到用法详解,... 目录一、Django 简介 二、Django 的安装教程 1. 创建虚拟环境2. 安装Django三、创

linux安装、更新、卸载anaconda实践

《linux安装、更新、卸载anaconda实践》Anaconda是基于conda的科学计算环境,集成1400+包及依赖,安装需下载脚本、接受协议、设置路径、配置环境变量,更新与卸载通过conda命令... 目录随意找一个目录下载安装脚本检查许可证协议,ENTER就可以安装完毕之后激活anaconda安装更

Jenkins的安装与简单配置过程

《Jenkins的安装与简单配置过程》本文简述Jenkins在CentOS7.3上安装流程,包括Java环境配置、RPM包安装、修改JENKINS_HOME路径及权限、启动服务、插件安装与系统管理设置... 目录www.chinasem.cnJenkins安装访问并配置JenkinsJenkins配置邮件通知