Professional Documents
Culture Documents
HTTP URI
Request Marshalls to Database SQL & PLSQL
HTTP/1.1 200 OK
{json} { "id": 1,
"name": "Jeff",
"job": "PM",
"salary": 100 }
ORDS Architecture
Webserver layout
HTTP(s) Request
• Results
Tomcat/WLS or
Binary
/db1/hr/emp/
• HTML
…
ORDS
FAIL
GENERATING LINKS
Building your Templates
Avoid dead-ends
POST vs GET
POST/PUT Tips
• Request Mime Type: Application/JSON
• :x – looks for {"x" :…}
• Parameters
• :bind is the VAR in the blog, name is the HEADER label
• Use to work with REQUEST or RESPONSE elements of your API
PL/SQL
1. ORDS Enable PL/SQL (package, proc, func)
2. OR Publish a REST Module
AUTO RESTful Service
• RPC for PL/SQL program • Your code -
• Input params in req body • Inputs, outputs, error handling, response
• OUT/RETURNs codes, formatting
transformed and returned • Print HTML, return JSON, download
as JSON response files…
PL/SQL & REFCURSORs
1. SELECT – func with OUT sys_refcursor
2. ANON Block
3. Call SP, send OUT to a RESULTSET OUT PARAM
4. AUTO
AUTO PL/SQL REFCUR
ANON Block REFCUR
PL/SQL Download File
CREATE OR REPLACE PROCEDURE download_file ( media_id NUMBER ) AS
vMIMETYPE VARCHAR2(256);
vLENGTH NUMBER;
vFILENAME VARCHAR2(2000);
vBLOB BLOB;
BEGIN
SELECT file_name, content_type, content INTO vFILENAME, vMIMETYPE, VBLOB
FROM media
WHERE id = media_id;
vLENGTH := DBMS_LOB.GETLENGTH(vBLOB);
owa_util.mime_header(NVL(vMIMETYPE, 'application/octet'), FALSE);
htp.p('Content-length: ' || vLENGTH);
htp.p('Content-Disposition: attachment; filename=' || SUBSTR(vFILENAME, INSTR(vFILENAME, '/') + 1) || ‘’);
owa_util.http_header_close;
wpg_docload.download_file(vBLOB);
END download_file;
/
Uploading Files - BLOBS
Converged Database
• One DB engine – ALL data & workloads
• Support for Microservices, Events, REST, SaaS…
• Accessed/Managed with SQL * PL/SQL
Read more on Converged Databases with Maria Colgan
JSON Documents
OAuth2
DBA. Me. Want. Stuff!
• Provide access, easily to your DBs
• Automation
• Monitoring
DB-API: 500+ Endpoints
Performance Monitoring PDB Lifecyle General
What isn’t running well? Problematic Activity Multitenant Management Data Dictionary Reports
• ASH • Sessions • Create • tables/,
• AWR • Locks • Clone tables/{table}
• RTSM • Waits • Change State • indexes/…
• Top SQL • Alert Log • Drop Database Operations
• Reports • DBCA
• Data Pump
DB-API: Turn it on
<entry key="database.api.enabled">true</entry>
DB-API: Docs