Oracle REST Data Services (ORDS) : Installation on Tomcat (Windows)
Oracle REST Data Services (ORDS), formerly known as the APEX Listener, allows APEX applications to be deployed without the use of Oracle HTTP Server (OHS) and mod_plsql or the Embedded PL/SQL Gateway. ORDS version 3.0 onward also includes JSON API support to work in conjunction with the JSON support in the database. ORDS can be deployed on WebLogic, Tomcat or run in standalone mode. This article describes the installation of ORDS on Tomcat 9 running on Windows.
- Multitenant : CDB or PDB Installation
- ORDS Installation
- Tomcat Deployment
- Starting/Stopping ORDS Under Tomcat
- ORDS Repair
- ORDS Uninstall
We need the Java and Tomcat software installed on the server before we can proceed.
- Down load Java SE 17 from here. We used the "Windows x64 MSI Installer". It's OK to use the Oracle JDK, as it is being used to run an official Oracle product (ORDS), so you don't need to pay support for Java.
- Install it by double-clicking and accepting the defaults.
- Download the Tomcat 9 software from here. We used the "32-bit/64-bit Windows Service Installer", so Tomcat would run as a Windows Service.
- Install it by double-clicking and filling in the details when prompted. Remember to select the Java 17 installation as your Java home.
We will also need the ORDS and APEX software. This article will assume it is in our "%USERPROFILE%\Downloads" directory.
Multitenant : CDB or PDB Installation
When using the multitenant architecture there are several options for how to install ORDS. For this article we are going to install ORDS into the PDB. This is preferable for Lone-PDB installations (a CDB with one PDB), or for CDBs with small numbers of PDBs
If you are using many PDBs per CDB, you may prefer to install ORDS into the CDB. You can read more about the CDB installation options here.
Check the SYS user (or an alternative SYSDBA user) and common public users are unlocked. Remember to lock the SYS user when the installation is complete. Change the passwords as required.
conn / as sysdba alter user sys identified by SysPassword1 account unlock container=all; alter session set container = pdb1; alter user apex_listener identified by OraPassword1 account unlock; alter user apex_public_user identified by OraPassword1 account unlock; alter user apex_rest_public_user identified by OraPassword1 account unlock; -- The next one will fail if you've never installed ORDS before. Ignore errors. alter user ords_public_user identified by OraPassword1 account unlock;
All commands are run with the command prompt unless otherwise stated.
Make a directory for the ORDS software.
Unzip the ORDS software into the directory.
powershell -command "Expand-Archive -LiteralPath %USERPROFILE%\Downloads\ords-latest.zip -DestinationPath c:\app\ords"
Make a config directory for ORDS, with a logs subdirectory.
Install ORDS. Amend the environment variables as required, and enter the SYSDBA and ORDS_PUBLIC_USER passwords when prompted.
set ORDS_HOME=c:\app\ords set ORDS_CONFIG=c:\app\config\ords set ORDS_LOGS=%ORDS_CONFIG%\logs set DB_HOSTNAME=localhost set DB_PORT=1521 set DB_SERVICE=pdb1 set SYSDBA_USER=SYS c:\app\ords\bin\ords.exe ^ --config %ORDS_CONFIG% install ^ --log-folder %ORDS_LOGS% ^ --admin-user %SYSDBA_USER% ^ --db-hostname %DB_HOSTNAME% ^ --db-port %DB_PORT% ^ --db-servicename %DB_SERVICE% ^ --feature-db-api true ^ --feature-rest-enabled-sql true ^ --feature-sdw true ^ --gateway-mode proxied ^ --gateway-user APEX_PUBLIC_USER ^ --proxy-user
Add the ORDS "bin" directory to your path permanently, and in the current session.
setx PATH "%PATH%;c:\app\ords\bin" set PATH="%PATH%;c:\app\ords\bin"
Unzip the APEX software.
powershell -command "Expand-Archive -LiteralPath %USERPROFILE%\Downloads\apex-latest.zip -DestinationPath %USERPROFILE%\Downloads"
Copy the APEX images to the Tomcat "webapps\i" directory.
set CATALINA_HOME="c:\Program Files\Apache Software Foundation\Tomcat 9.0" mkdir %CATALINA_HOME%\webapps\i xcopy /s %USERPROFILE%\Downloads\apex\images %CATALINA_HOME%\webapps\i\
Copy the "ords.war" file to the Tomcat "webapps" directory.
copy C:\app\ords\ords.war %CATALINA_HOME%\webapps\
_JAVA_OPTIONS environment variable must include a reference to the "-Dconfig.url" flag, to tell ORDS where to find the ORDS configuration. Some references suggest you may need to use the
JAVA_TOOL_OPTIONS environment variable instead of
_JAVA_OPTIONS environment variable.
This can be done in one of two ways. We could create a system variable with the following details, but that would affect any java processes on the server.
Variable Name: _JAVA_OPTIONS Variable Value: -Dconfig.url=c:\app\config\ords
Alternatively we could run the following program.
"C:\Program Files\Apache Software Foundation\Tomcat 9.0\bin\Tomcat9w.exe"
Then add the variable value to the "Java Options" on the "Java" tab.
After restarting Tomcat (see below) ORDS should now be accessible using the following type of URL.
Starting/Stopping ORDS Under Tomcat
ORDS is started or stopped using the Windows service. We must be running the command prompt as the administrator.
net stop "Apache Tomcat 9.0 Tomcat9" net start "Apache Tomcat 9.0 Tomcat9"
We can repair the current ORDS installation using the following command.
set ORDS_HOME=c:\app\ords set ORDS_CONFIG=c:\app\config\ords set ORDS_LOGS=%ORDS_CONFIG%\logs c:\app\ords\bin\ords.exe --config %ORDS_CONFIG% install repair --interactive --log-folder %ORDS_LOGS%
ORDS is uninstalled using the following command.
set ORDS_HOME=c:\app\ords set ORDS_CONFIG=c:\app\config\ords c:\app\ords\bin\ords.exe --config %ORDS_CONFIG% uninstall --interactive
For more information see:
- Oracle REST Data Services : Installation and Configuration Guide
- Oracle REST Data Services Documentation Release
- Oracle REST Data Services (ORDS) Articles
Hope this helps. Regards Tim...