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 replaceOracle HTTP server and mod_plsql. It bases on Java EE that provides RESTful service and increasessecurity capability. it can deploy onWebLogic,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 APEXwhich 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 APEXon a specific web server such as WebLogic,Tomcat or Glassfish,...
Link worked with Oracle APEX as followed:
Method 1:Configure the Embedded PL/sql Gateway: This is the way to configure Oracle APEXwhich 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 APEXon a specific web server such as WebLogic,Tomcat or Glassfish,...
Link worked with Oracle APEX as followed:
- http://your-server:8080/apex
To use
RESTfulservices,you need to install
Oracle ORDSwhich can deploy onWebLogic Server,Glassfish,.. or independently. Oracle ORDS can read directly to Oracle APEX and replace completelyOracle HTTP Server,therefore you can use
RESTfulon APEX and new URL to work with
Oracle APEX.
- http://your-server:8080/ords
4- Download Oracle ORDS
You can download Oracle ORDS at:
Download results:
5- Config ORDS for APEX
CD to apex home directory.
Login to
sqlplusas sysdba.
Run the command to configure REST Service.
1
2
3
4
|
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.
- APEX_LISTENER- The account used to query RESTful Services definitions stored in Oracle Application Express.
- 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_ADMINin order to to grant connect privileges to any host for the
APEX_050000database user
You need to query to view the APEX users in the database:
1Select
Username
from
All_Users
where
username
like
'APEX%'
;
Run command to grant connect privileges to any host for the APEX_050000 database user.
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
Upper_Port
Null
;
If Dbms_Network_Acl_Admin.Check_Privilege(Acl_Path
,
'APEX_050000'
'connect'
)
Null
Then
Dbms_Network_Acl_Admin.Add_Privilege(Acl_Path
'APEX_050000'
sql spaces" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; Box-sizing: content-Box !important; font-family: Consolas,
True
);
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
);
Dbms_Network_Acl_Admin.Assign_Acl(
'power_users.xml'
'*'
);
;
/
Commit
;