Before a database schema can be used to define RESTful Services you need to enable the schema so that ORDS can access it. It’s really simple and only takes a second to do.
Before you go any further you’ll need to download and install ORDS 3.0.0 EA2. You can follow the instructions here, it’ll take just a couple of minutes.
The example below uses Oracle SQLCL 1, but you can use SQL Plus, SQL Developer or whatever your favorite SQL editor is.
In a command prompt fire up sqlcl
as a user who has rights to create
schemas:
|
|
Create a schema to enable for use with ORDS, we’re going to call it ordstest
:
|
|
Switch to the ordstest
schema and enable the schema for use with ORDS:
|
|
Query the USER_ORDS_SCHEMAS
view to confirm the schema has been enabled:
|
|
When you call ords.enable_schema
, a few things happen:
The schema is configured so that ords_public_user
can proxy to the schema.
In the above example the following alter user
command is issued:
|
|
A ‘base path’ url mapping is created that maps the schema to the lowercase
form of it’s name. In the above example, assuming ORDS is listening on
http://localhost:8080/ords/
, then resources in the ordstest schema can be
accessed under:
|
|
Some internal house keeping occurs, like the creation of some stock privilege mappings to protect the JSON Document Store resources.
Oracle SQLCL is the new command line SQL editor from the SQL Developer team. It’s like a modern SQL Plus, you should try it out, especially if you are on a Mac, since it’s Java based it doesn’t require any Oracle Database driver install. ↩︎