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.
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 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.
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.22.214.171.1243.15.32.zip. I downloaded it from Oracle Technet:
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.126.96.36.1993.15.32.zip /u01/app/oracle/product/ords
$ cd /u01/app/oracle/product/ords
$ unzip ords.188.8.131.523.15.32.zip
Make some setup configurational changes
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
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.
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)
The password for parameter user.public.password is obscured after running the setup (see later on in this article)
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.
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:
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:
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.
$ progress= deploy(‘ords’,’/u01/app/oracle/product/ords/ords.war’,’AdminServer’)
And your ORDS installation is ready for creating REST service!
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
- Oracle REST Data Services
- REST DATA Services Installation, Configuration, and Development Guide
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!