In this tutorial, we will run through the process of exposing and RDBMS as an OData service. When OData is enabled for an datasource, you do not need to manually define CRUD operations. These will be automatically created.
Note that the OData feature can only be used for RDBMS and Cassandra datasources.
Setting up an RDBMS
Follow the steps given below to set up a MySQL database for this tutorial.
- Install the MySQL server.
- Download the JDBC driver for MySQL from here and copy it to your
Create a MySQL database with the following table:
Enter the following data into the table:
Expose the RDBMS as an OData service
Follow the steps given below.
- When you connect the datasource, select the OData check box as shown below.
Access the data service using CRUD operations
Open a command prompt execute the following CURL commands using CRUD operations:
Note that the user should have privileges to perform CRUD operations on the database. For Oracle databases, the user should be the schema owner. If not, the OData service will not work properly.
To get the service document:
To get the metadata of the service:
To read details from the ACCOUNT table: