Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use PL/SQL to create RESTful Web Services

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to use PL/SQL to create RESTful Web Services, the article is very detailed, has a certain reference value, interested friends must read it!

Version:

Ords.18.1.1.95.1251

Jdk1.8.0_171

Set up JDK

Export JAVA_HOME=/u/dba/oracle/frank/jdk1.8.0_171

Export PATH=$JAVA_HOME/bin:$PATH

Set up ORDS

Bash-4.1$ java-jar ords.war install advanced

This Oracle REST Data Services instance has not yet been configured.

Please complete the following prompts

Enter the location to store configuration data:/lv01/apache-tomcat-8.5.31/ords/config

Enter the name of the database server [localhost]:

Enter the database listen port [1521]: 152X

Enter 1 to specify the database service name, or 2 to specify the database SID [1]: 2

Enter the database SID [xe]:

Enter 1 if you want to verify/install Oracle REST Data Services schema or 2 to skip this step [1]:

Enter the database password for ORDS_PUBLIC_USER:

Confirm password:

Requires SYS AS SYSDBA to verify Oracle REST Data Services schema.

Enter the database password for SYS AS SYSDBA:

Confirm password:

Retrieving information.

Enter the default tablespace for ORDS_METADATA [SYSAUX]:

Enter the temporary tablespace for ORDS_METADATA [TEMP]:

Enter the default tablespace for ORDS_PUBLIC_USER [USERS]:

Enter the temporary tablespace for ORDS_PUBLIC_USER [TEMP]:

Enter 1 if you want to use PL/SQL Gateway or 2 to skip this step.

If using Oracle Application Express or migrating from mod_plsql then you must enter 1 [1]: 2

Jul 04, 2018 7:07:23 PM

INFO: Updated configurations: defaults, apex_pu

Installing Oracle REST Data Services version 18.1.1.95.1251

... Log file written to / web01/apache-tomcat-8.5.31/ords/logs/ords_install_core_2018-07-04_190723_00459.log

... Verified database prerequisites

... Created Oracle REST Data Services schema

... Created Oracle REST Data Services proxy user

... Granted privileges to Oracle REST Data Services

... Created Oracle REST Data Services database objects

... Log file written to / web01/apache-tomcat-8.5.31/ords/logs/ords_install_datamodel_2018-07-04_190806_00041.log

... Log file written to / web01/apache-tomcat-8.5.31/ords/logs/ords_install_apex_2018-07-04_190807_00872.log

Completed installation for Oracle REST Data Services version 18.1.1.95.1251. Elapsed time: 00:00:45.790

Enter 1 if you wish to start in standalone mode or 2 to exit [1]: 2

Validate database objects after installation is complete

Bash-4.1$ java-jar ords.war validate

Requires SYS AS SYSDBA to verify Oracle REST Data Services schema.

Enter the database password for SYS AS SYSDBA:

Confirm password:

Retrieving information.

Oracle REST Data Services will be validated.

Validating Oracle REST Data Services schema version 18.1.1.95.1251

... Log file written to / web01/apache-tomcat-8.5.31/ords/logs/ords_validate_core_2018-07-04_191324_00217.log

Completed validating Oracle REST Data Services version 18.1.1.95.1251. Elapsed time: 00:00:12.509

View / web01/apache-tomcat-8.5.31/ords/logs/ords_validate_core_2018-07-04_191324_00217.log

[* * script: ords_validate_objects.sql]

Session altered.

INFO: 19:13:27 Validating objects for Oracle REST Data Services.

VALIDATION: 19:13:27 Starting validation for schema: ORDS_METADATA

VALIDATION: 19:13:27 Validating objects

VALIDATION: 19:13:35 Validating ORDS Public Synonyms

VALIDATION: 19:13:36 Total objects: 244, invalid objects: 0

VALIDATION: 19:13:36 72 INDEX

VALIDATION: 19:13:36 1 JOB

VALIDATION: 19:13:36 11 PACKAGE

VALIDATION: 19:13:36 11 PACKAGE BODY

VALIDATION: 19:13:36 43 PUBLIC SYNONYM

VALIDATION: 19:13:36 1 SEQUENCE

VALIDATION: 19:13:36 27 TABLE

VALIDATION: 19:13:36 26 TRIGGER

VALIDATION: 19:13:36 19 TYPE

VALIDATION: 19:13:36 6 TYPE BODY

VALIDATION: 19:13:36 27 VIEW

VALIDATION: 19:13:36 Validation completed.

INFO: 19:13:36 Completed validating objects for Oracle REST Data Services. PL/SQL procedure successfully completed.

Add a database map

Export JAVA_HOME=/u/dba/oracle/frank/jdk1.8.0_171

Export PATH=$JAVA_HOME/bin:$PATH

Java-jar ords.war map-url-- type base-path /

Jul 11, 2018 6:40:33 PM

INFO: Creating new mapping from: [base-path,/] to map to: [,]

Set up a simple test in the database

Sqlplus testuser1/testuser1@ CREATE TABLE EMP (

EMPNO NUMBER (4)

ENAME VARCHAR2 (10 BYTE)

JOB VARCHAR2 (9 BYTE)

MGR NUMBER (4)

HIREDATE DATE

SAL NUMBER (7 dint 2)

COMM NUMBER (7 dint 2)

DEPTNO NUMBER (2Jing 0)

CONSTRAINT PK_EMP PRIMARY KEY (EMPNO)

);

Insert into EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7369, "SMITHQ,"CLERKLERK," 7902, "to date,"), ("17,17, DECly80," DDMN, RR'), 800, "nullmeme20."

Insert into EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7499 minutes), Salesmand (7698), to date ('20, FEBMB, 81, dm, Mon, R'), 1600, 300, 30)

Insert into EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7521, 1250, 500, 30, etc.)

Insert into EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7566 and Managerie, 7839 to date), 2975 and NullLind 20)

Insert into EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7654 and 1400) values (7654 and 1400)

Insert into EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7698 memorials, blackmail repartees, Managerian pamphlets, 7839 memorials, tokens date), 2850, nullmague 30)

Insert into EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7782MANAGERL) to date ('09Sumi Junli 81')), 2450 ~ nullLind 10)

Insert into EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7788, Japanese, and Japanese) (756, 756, 556, 556, 556, 556, 556, 756, 556, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 556, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756

Insert into EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7839), "KINGGHAN,"PRESIDENTRING,"nullmeme, totaldate," ('17,

Insert into EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7844 Personnal) values (7844pr.)

Insert into EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7876 pr. Adams) pr. CLERK. 778.

Insert into EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7900 penchant JAMESZHANG CLERKR), 7698 memoir tokendate ('03Perk, DECFE81, DDMN, RR')

Insert into EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7902, 556, 556, 556, 556, 556, 556, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 556, 756, 756, 756, 756, 756, 756, 756, 556, 756, 756, 756, 756, 756, 756, 556, 756, 556, 756, 756, 756, 756, 756, 7

Insert into EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7934 MILLERECHERY, CLERKE, 7782, JANFUR 82, DDMN, RR'), 1300

Commit

# enable schema

CONN testuser1/testuser1@

BEGIN

ORDS.enable_schema (

P_enabled = > TRUE

P_schema = > 'TESTUSER1'

P_url_mapping_type = > 'BASE_PATH'

P_url_mapping_pattern = > 'testuser1'

P_auto_rest_auth = > FALSE

);

COMMIT

END

/ ase ORDS URL: http://:8080/ords//

Schema (alias): http://.bv.tek.com:8080/ords//testuser1/

Module: http://.bv.tek.com:8080/ords//testuser1/testmodule1/

Template: http://.bv.tek.com:8080/ords//testuser1/testmodule1/emp/ BEGIN

ORDS.define_module (

P_module_name = > 'testmodule2'

P_base_path = > 'testmodule2/'

P_items_per_page = > 0)

ORDS.define_template (

P_module_name = > 'testmodule2'

P_pattern = > 'emp/')

ORDS.define_handler (

P_module_name = > 'testmodule2'

P_pattern = > 'emp/'

P_method = > 'GET'

P_source_type = > ORDS.source_type_collection_feed

P_source = > 'SELECT * FROM emp'

P_items_per_page = > 0)

COMMIT

END

The above is all the content of the article "how to use PL/SQL to create RESTful Web Services". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 211

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report