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

相关文章

Python使用国内镜像加速pip安装的方法讲解

《Python使用国内镜像加速pip安装的方法讲解》在Python开发中,pip是一个非常重要的工具,用于安装和管理Python的第三方库,然而,在国内使用pip安装依赖时,往往会因为网络问题而导致速... 目录一、pip 工具简介1. 什么是 pip?2. 什么是 -i 参数?二、国内镜像源的选择三、如何

oracle DBMS_SQL.PARSE的使用方法和示例

《oracleDBMS_SQL.PARSE的使用方法和示例》DBMS_SQL是Oracle数据库中的一个强大包,用于动态构建和执行SQL语句,DBMS_SQL.PARSE过程解析SQL语句或PL/S... 目录语法示例注意事项DBMS_SQL 是 oracle 数据库中的一个强大包,它允许动态地构建和执行

Ubuntu固定虚拟机ip地址的方法教程

《Ubuntu固定虚拟机ip地址的方法教程》本文详细介绍了如何在Ubuntu虚拟机中固定IP地址,包括检查和编辑`/etc/apt/sources.list`文件、更新网络配置文件以及使用Networ... 1、由于虚拟机网络是桥接,所以ip地址会不停地变化,接下来我们就讲述ip如何固定 2、如果apt安

Python安装时常见报错以及解决方案

《Python安装时常见报错以及解决方案》:本文主要介绍在安装Python、配置环境变量、使用pip以及运行Python脚本时常见的错误及其解决方案,文中介绍的非常详细,需要的朋友可以参考下... 目录一、安装 python 时常见报错及解决方案(一)安装包下载失败(二)权限不足二、配置环境变量时常见报错及

PyCharm 接入 DeepSeek最新完整教程

《PyCharm接入DeepSeek最新完整教程》文章介绍了DeepSeek-V3模型的性能提升以及如何在PyCharm中接入和使用DeepSeek进行代码开发,本文通过图文并茂的形式给大家介绍的... 目录DeepSeek-V3效果演示创建API Key在PyCharm中下载Continue插件配置Con

Deepseek R1模型本地化部署+API接口调用详细教程(释放AI生产力)

《DeepseekR1模型本地化部署+API接口调用详细教程(释放AI生产力)》本文介绍了本地部署DeepSeekR1模型和通过API调用将其集成到VSCode中的过程,作者详细步骤展示了如何下载和... 目录前言一、deepseek R1模型与chatGPT o1系列模型对比二、本地部署步骤1.安装oll

在不同系统间迁移Python程序的方法与教程

《在不同系统间迁移Python程序的方法与教程》本文介绍了几种将Windows上编写的Python程序迁移到Linux服务器上的方法,包括使用虚拟环境和依赖冻结、容器化技术(如Docker)、使用An... 目录使用虚拟环境和依赖冻结1. 创建虚拟环境2. 冻结依赖使用容器化技术(如 docker)1. 创

Spring Boot整合log4j2日志配置的详细教程

《SpringBoot整合log4j2日志配置的详细教程》:本文主要介绍SpringBoot项目中整合Log4j2日志框架的步骤和配置,包括常用日志框架的比较、配置参数介绍、Log4j2配置详解... 目录前言一、常用日志框架二、配置参数介绍1. 日志级别2. 输出形式3. 日志格式3.1 PatternL

PLsql Oracle 下载安装图文过程详解

《PLsqlOracle下载安装图文过程详解》PL/SQLDeveloper是一款用于开发Oracle数据库的集成开发环境,可以通过官网下载安装配置,并通过配置tnsnames.ora文件及环境变... 目录一、PL/SQL Developer 简介二、PL/SQL Developer 安装及配置详解1.下

MySQL8.2.0安装教程分享

《MySQL8.2.0安装教程分享》这篇文章详细介绍了如何在Windows系统上安装MySQL数据库软件,包括下载、安装、配置和设置环境变量的步骤... 目录mysql的安装图文1.python访问网址2javascript.点击3.进入Downloads向下滑动4.选择Community Server5.