Pre-General Availability: 2017-09-04
This section explains how to configure Oracle REST Data Services for connecting to multiple databases for routing requests, and it refers to other documentation sources for other configuration information.
Note:
Oracle REST Data Services must be restarted after making configuration changes. See your application server documentation for information on how to restart applications.
Topics:
Oracle REST Data Services supports the ability to connect to more than one database. This section describes different strategies for routing requests to the appropriate database.
Topics:
Oracle REST Data Services supports a number of different strategies for routing requests to the appropriate database. All of these strategies rely on examining the request URL and choosing the database based on some kind of match against the URL. It is useful to recap the pertinent portions of a request URL. Consider the following URL:
https://www.example.com/ords/sales/f?p=1:1
This URL consists of the following sections:
Protocol: https
Host Name: www.example.com
Context Root: /ords
The context root is the location at which Oracle REST Data Services is deployed on the application server.
Request Path: /sales/f?p=1.1
This is the portion of the request URL relative to the context root.
For different applications, it may be important to route requests based on certain prefixes in the request path or certain prefixes in the full request URL.
There are two steps to configuring multiple databases:
Configuring the database connection information
Configuring which requests are routed to which database
When you first configure Oracle REST Data Services, you configure a default database connection named: apex
. You can create additional database connections using the setup
command.
Tip:
To see full help for the setup
command type:
java -jar ords.war help setup
To create a database connection type the following:
java -jar ords.war setup --database <database name>
Where:
<database name>
is the name you want to give the database connection.
You are prompted to enter the information required to configure the database. After you have configured the additional databases, define the rules for how requests are routed to the appropriate database.
You create request routing rules using the map-url
command.
Tip:
To see full help for the map-url
command type:
java -jar ords.war help map-url
If you want to route requests based just on matching a prefix in the request path portion of the URL, use the map-url
command as follows:
java -jar ords.war map-url --type base-path --workspace-id <workspace name> <path prefix> <database name>
Where:
<workspace name>
is the name of the Oracle Application Express workspace where RESTful services for this connection are defined. This may be omitted if RESTful Services are not being used.
<path prefix>
is the prefix that must occur at the start of the request path.
<database name>
is the name of the database connection configured in the previous step.
Related Topics
Assuming Oracle REST Data Services is deployed on a system named example.com
at the context path /ords
, then create the following rule:
java -jar ords.war map-url --type base-path --workspace-id sales_rest /sales sales_db
This rule means that any requests matching https://example.com/ords/sales/...
are routed to the sales_db
database connection. The sales_rest
workspace defined within the sales_db
database is searched for RESTful Services definitions.
The previous rule matches all of the following requests:
https://example.com/ords/sales/f?p=1:1
https://example.com/ords/sales/leads/
https://www.example.com/ords/sales/forecasting.report?month=jan (If www.example.com resolves to the same system as example.com.)
The previous rule does not match of any of the following requests:
http://example.com/ords/sales/f?p=1:1 (The protocol is wrong.) https://example.com:8080/ords/sales/f?p=1:1 (The port is wrong: 443 is default for https, but don't specify if using default.) https://example.com/ords/f?p=1:1 (Missing the /sales prefix.) https://example.com/pls/sales/leads/ (The context path is wrong.)
If you want to route requests based on a match of the request URL prefix, use the map-url
command as follows:
java -jar ords.war map-url --type base-url --workspace-id <workspace name> <url prefix> <database name>
Where:
<workspace name>
is the name of the Oracle Application Express workspace where RESTful services for this connection are defined. This may be omitted if RESTful Services are not being used.
<url prefix>
is the prefix with which the request URL must start.
<database name>
is the name of the database connection.
Assuming Oracle REST Data Services is deployed on a system named example.com
at the context path /ords
, then create the following rule:
java -jar ords.war map-url --type base-url --workspace-id sales_rest https://example.com/ords/sales sales_db
This rule means that any requests matching https://example.com/ords/sales/...
are routed to the sales_db
database connection. The sales_rest
workspace defined within the sales_db
database is searched for RESTful Services definitions.
The previous rule matches all of the following requests:
https://example.com/ords/sales/f?p=1:1 https://example.com/ords/sales/leads/ https://example.com/ords/sales/forecasting.report?month=jan
The previous rule does not match of any of the following requests:
http://example.com/ords/sales/f?p=1:1 (The protocol is wrong.) https://example.com:8080/ords/sales/f?p=1:1 (The port is wrong: 443 is default for https, but don't specify if using default.) https://example.com/ords/f?p=1:1 (Missing the /sales segment of the base URL.) https://example.com/pls/sales/leads/ (The context path is wrong.) https://www.example.com/ords/sales/forecasting.report?month=jan (The host name is wrong.)
Oracle REST Data Service (ORDS) supports the Fast Connection Failover (FCF) feature of Oracle Real Application Clusters (Oracle RAC).
Oracle REST Data Service runs with the Universal Connection Pool (UCP) in all the Application Server environments that it supports, such as WebLogic, Tomcat, GlassFish. UCP in turn supports Fast Connection Failover . To enable FCF, Oracle Notification Service (ONS) must to be enabled. To enable ONS, add entries to the list of properties in the Oracle REST Data Services defaults.xml
configuration file as shown in the following code snippet:
<entry key="jdbc.enableONS">true</entry> <entry key= "jdbc.ONSConfig">nodes=racnode1:4200,racnode2:4200\nwalletfile=/oracle11/onswalletfile</entry>
<entry key="db.connectionType">customurl</entry> <entry key="db.customURL">jdbc:oracle:thin:@(DESCRIPTION=(FAILOVER=ON)(ADDRESS_LIST= (LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=prod_scan.example.com)(PORT=1521))) (CONNECT_DATA=(SERVICE_NAME=ISPRD)))|</entry>
After updating the defaults.xml
configuration file, ORDS need to be restarted for the changes to take effect.
Unplanned outages: When RAC detects an instance failure, it generates a FAN Down event which FCF picks up. FCF then terminates all connections to the failed instance and directs all future requests to the surviving RAC instances.
Planned outages: For instance, when a Database Administrator (DBA) wants to gracefully shut down a RAC instance for performing some maintenance activity. The instance shutdown generates a FAN Planned Down event which FCF picks up. FCF then directs all new requests to other RAC instances and drains or allows currently active transactions to complete.
Note:
Long running transactions may need to be terminated forcefully.To configure security, caching, pre- and post- processing, environment, and Excel settings, see Using SQL Developer Oracle REST Data Services Administration (Optional).
This section explains how to configure the REST Enabled SQL service.
Note:
Enabling the REST Enabled SQL service enables authentication against the ORDS enabled database schemas. This makes the database schemas accessible over HTTPS, using the database password. Oracle highly recommends that you provide strong secure database passwordsLocate the folder where the Oracle REST Data Services configuration is stored.
Open the defaults.xml
file and add the following entry: <entry key="restEnabledSql.active">true</entry>
.
Save the file.
Restart Oracle REST Data Services for the changes to take effect.
This section explains how to configure the maximum number of rows returned from a query.
Locate the folder where the Oracle REST Data Services configuration is stored.
Open the defaults.xml
file and update the value of the jdbc.maxRows
parameter as follows:<entry key=”jdbc.maxRows”>1500</entry>
Note:
Default value forjdbc.maxRows
is 500.Save the file.
Restart Oracle REST Data Services for the changes to take effect.
For more information on how to develop RESTful Services for use with Oracle REST Data Services, see Developing Oracle REST Data Services Applications.