Multiple databases on a single ORDS

Multiple databases on a single ORDS

APEX does not function without ORDS, and sometimes we want to connect two or more database instances, or APEX instances such as DEV, TEST and PROD, to a single ORDS server. To do that we need to issue 2 commands, just remember that you need to issue these commands while being in the ORDS directory where the ords.war file is located:

  1. Issue sql java -jar ords.war setup --database <database_name>, where <database_name> is simply the name you want to give this instance. Follow the terminal's instructions. This will create one to four XML configuration files in the /ords/conf directory. These files contain the credentials needed to connect to database users, such as APEX_LISTENER or APEX_PUBLIC_USER.
  2. Then issue the command java -jar ords.war map-url --type base-path /<path> <database_name> , where <database_name> is the name of the database, and <path> is the path in the URL you will use to connect to the APEX instance. This command will create an entry in the /ords/url-mapping.xml file.
  3. Repeat this process for the other databases.

If you want to read more about Routing Based on the Request Path Prefix, click here.

Simple, right? But what if you want to disable one of the databases? For example, in order to update APEX?

You can simply go to the /ords/url-mapping.xml file and delete the mapping. To be sure, you can also delete the XML files generated in the /ords/conf directory. Remember, to restart the ORDS server.