In my job as system administrator/DBA/integrator I was challenged to implement smoketesting using REST calls. Implementing REST in combination with WebLogic is pretty easy. But then we wanted to extend smoketesting to the database. For example we wanted to know if the database version and patch level were at the required level as was used throughout the complete DTAP environment. Another example is the existence of required database services. As it turns out Oracle has a feature called ORDS – Oracle REST Data Service – to accomplish this.
With ORDS you can install it in 2 different scenario’s, in standalone mode on the database server, or in combination with an application server such as WebLogic Server, Glassfish Server, or Tomcat.
This article will give a short introduction to ORDS. It then shows you how to install ORDS feasible for a production environment using WebLogic Server 12c and an Oracle 12c database as we have done for our smoketesting application.
We’ve chosen WebLogic Server to deploy the ORDS application because we already used WebLogic’s REST feature for smoketesting the application and WebLogic resources, and for high availability reasons because we use an Oracle RAC database. Also running in stand-alone mode would lead to additional security issues for port configutions.
Terminology
REST: Representational State Transfer. It provides interoperability on the Internet between computer systems.
ORDS: Oracle REST Data Services. Oracle’s implementation of RESTful services against the database.
RESTful service: an http web service that follows the REST architecture principles. Access to and/or manipulation of web resources is done using a uniform and predefined set of stateless operators.
ORDS Overview
ORDS makes it easy to develop a REST interface/service for relational data. This relational data can be stored in either an Oracle database, an Oracle 12c JSON Document Store, or an Oracle NoSQL database.
A mid-tier Java application called ORDS, maps HTTP(S) requests (GET, PUT, POST, DELETE, …) to database transactions and returns results in a JSON format.
Installation Process
The overall process of installing and configuring ORDS is very simple.
- Download the ORDS software
- Install the ORDS software
- Make some setup configurational changes
- Run the ORDS setup
- Make a mapping between the URL and the ORDS application
- Deploy the ORDS Java application
Download the ORDS software
Downloading the ORDS software can be done from the Oracle Technology Network. I used version ords.3.0.12.263.15.32.zip. I downloaded it from Oracle Technet:
http://www.oracle.com/technetwork/developer-tools/rest-data-services/downloads/index.html
Install the ORDS software
The ORDS software is installed on the WebLogic server running the Administration console. Create an ORDS home directory and unzip the software.
Here are the steps on Linux
$ mkdir -p /u01/app/oracle/product/ords
$ cp -p ords.3.0.12.263.15.32.zip /u01/app/oracle/product/ords
$ cd /u01/app/oracle/product/ords
$ unzip ords.3.0.12.263.15.32.zip
Make some setup configurational changes
ords_params.properties File
Under the ORDS home directory a couple of subdirectories are created. One subdirectory is called params. This directory holds a file called ords_params.properties. This file holds some default parameters that are used during the installation. This file ords_params.properties, is used for silent installation. In case any parameters aren’t specified in this file, ORDS interactively asks you for the values.
In this article I go for a silent installation. Here are the default parameters and the ones I set for installing
Parameter |
Default Value |
Configured Value |
db.hostname |
dbserver01.localdomain |
|
db.port |
1521 |
1521 |
db.servicename |
ords_requests |
|
db.username |
APEX_PUBLIC_USER |
APEX_PUBLIC_USER |
migrate.apex.rest |
false |
false |
plsql.gateway.add |
false |
false |
rest.services.apex.add |
false |
|
rest.services.ords.add |
true |
true |
schema.tablespace.default |
SYSAUX |
ORDS |
schema.tablespace.temp |
TEMP |
TEMP |
standalone.http.port |
8080 |
8080 |
user.public.password |
Ords4Ever! |
|
user.tablespace.default |
USERS |
ORDS |
user.tablespace.temp |
TEMP |
TEMP |
sys.user |
SYS |
|
sys.password |
Oracle123 |
NOTE
As you see, I refer to a tablespace ORDS for the installation of the metadata objects. Don’t forget to create this tablespace before continuing.
NOTE
The parameters sys.user and sys.password are removed from the ords_params.properties file after running the setup (see later on in this article)
NOTE
The password for parameter user.public.password is obscured after running the setup (see later on in this article)
NOTE
As you can see there are many parameters that refer to APEX. APEX is a great tool for rapidly developing very sophisticated applications nowadays. Although you can run ORDS together with APEX, you don’t have to. ORDS runs perfectly without an APEX installation.
Configuration Directory
I create an extra directory to hold all configuration data, called config directly under the ORDS home directory. Here all configurational data used during setup are stored.
$ mkdir config
$ java -jar ords.war configdir /u01/app/oracle/product/ords/config
$ # Check what value of configdir has been set!
$ java -jar ords.war configdir
Run the ORDS setup
After all configuration is done, you can run the setup, which installs the Oracle metadata objects necessary for running ORDS in the database. The setup creates 2 schemas called:
- ORDS_METADATA
- ORDS_PUBLIC_USER
The setup is run in silent mode, which uses the parameter values previously set in the ords_params.properties file.
$ mkdir -p /u01/app/oracle/logs/ORDS
$ java -jar ords.war setup –database ords –logDir /u01/app/oracle/logs/ORDS –silent
Make a mapping between the URL and the ORDS application
After running the setup, ORDS required objects are created inside the database. Now it’s time to make a mapping from the request URL to the ORDS interface in the database.
$ java -jar ords.war map-url –type base-path /ords ords
Here a mapping is made between the request URL from the client to the ORDS interface in the database. The /ords part after the base URL is used to map to a database connection resource called ords.
So the request URL will look something like this:
http://webserver01.localdomain:7001/ords/…
Where http://webserver01.localdomain:7001 is the base path.
Deploy the ORDS Java application
Right now all changes and configurations are done. It’s time to deploy the ORDS Java application against the WebLogic Server. Here I use wlst to deploy the ORDS Java application, but you can do it via the Administration Console as well, whatever you like.
$ wlst.sh
$ connect(‘weblogic’,’welcome01′,’t3://webserver01.localdomain:7001′)
$ progress= deploy(‘ords’,’/u01/app/oracle/product/ords/ords.war’,’AdminServer’)
$ disconnect()
$ exit()
And your ORDS installation is ready for creating REST service!
NOTE
After deployment of the ORDS Java application, it’s state should be Active and health OK. You might need to restart the Managed Server!
Deinstallation of ORDS
As the installation of ORDS is pretty simple, deinstallation is even more simple. The installation involves the creation of 2 schemas on the database and a deployment of ORDS on the application server. The deinstall process is the reverse.
- Undeploy ORDS from WebLogic Server
- Deinstall the database schemas using
$ java –jar ords.war uninstall
In effect this removes the 2 schemas from the database
- Optionally remove the ORDS installation directories
- Optionally remove the ORDS tablespace from the database
References
- Oracle REST Data Services
http://www.oracle.com/technetwork/developer-tools/rest-data-services/overview/index.html - REST DATA Services Installation, Configuration, and Development Guide
https://docs.oracle.com/cd/E56351_01/doc.30/e87809/toc.htm
Summary
The installation of ORDS is pretty simple. You don’t need to get any extra licenses to use ORDS. ORDS can be installed without installing APEX. You can run ORDS stand-alone, or use a J2EE webserver like WebLogic Server, Glassfish Server, or Apache Tomcat. Although you will need additional licenses for the use of these webservers.
Hope this helps!
hi,
i have two databases, can we use one ORDS for both databases? if not, then can we deploy two ORDS in the same weblogic server pointing to different databses?
Thanks
Hi Paul:
I’m trying to find the answers to these from various sources, but so far haven’t been able to, I hope you can answer these:
1) On your Linux box, who do you run this command as? tomcat or user=oracle?
$ java -jar ords.war setup –database ords –logDir /u01/app/oracle/logs/ORDS –silent
2) Do you need to have tomcat and Oracle running on the same box?
Thanks,
— kr
Hi Khalid,
1) On your Linux box, who do you run this command as? tomcat or user=oracle?
I’ld run it under user tomcat (the user which installed tomcat)
2) Do you need to have tomcat and Oracle running on the same box?
No, in my article I used 2 servers, 1 server running WebLogic, and another server running Oracle Database 12.1.0.2
I executed all commands from the “WebLogic” server.
Regards,
Paul
Hello Paul;
Is Oracle ORDS and Tomcat supported by Oracle support on any platform and OS?
Thank you.
Shaun
See for more information: Oracle REST Data Services (ORDS) / APEX Listener General FAQ (Doc ID 1536052.1). ‘As an open source web server, support for Tomcat is limited to issues specific to ORDS within Tomcat.’. Oracle does not support for (Tomcat) installation, troubleshooting, performance tuning, configuration, etc.
I would interpret this (I’m not from Oracle so this is a personal interpretation) as that Oracle will not provide support for Tomcat specifically (and no specific underlying OS for Tomcat is mentioned), but only for ORDS. I would guess Oracle will help you if an issue can and should (architecturally speaking) be solved by ORDS but not if the issue is caused by Tomcat configuration (such as authentication, logging, HTTPS configuration). When in doubt, you will probably have to provide evidence the issue is caused by ORDS in order to get support. In extension, support for issues in configuration in the underlying OS/platform is also something you should take care of yourself (or get support from other sources if you need it).
Hi Paul;
Just wondering is Oracle support will provide support for Tomcat and ORDS on any machince and operating systems?
Thanks
Shaun
Hi Paul,
I am trying to install ords version 18.2.0 with Tomcat as a Web Server.
I 100% follow all mentioned installation steps for ORDS. But I am unable to understand for Tomcat.
Could you please share the steps for Tomcat. When i try to copy ords.war on CATALINE_HOME/webapps. Its not working and give me below error.
404 Not Found
Thanks
Asif