Skip to main content
Skip table of contents

OData V4 Connector

The Open Data Protocol (OData) is a data access protocol built on core protocols like HTTP and commonly accepted methodologies like REST for the web. For more information about the OData interface, please refer to the dedicated page in the User Guide.

The OData V4 translator, known by the type name odata4, exposes the OData V4 data sources and uses the CData Virtuality web services resource adapter for making web service calls. These translators are an extension of the Web Services Translator.

CData Virtuality maps OData CSDL (Conceptual Schema Definition Language) document from the provided OData endpoint and converts the OData metadata into the CData Virtuality relational schema. The following table shows the mapping selections in the OData translators from a CSDL document

OData v4

Mapped to Relational Entity

EntitySet

Table

EntityType

Table

ComplexType

Table

FunctionImport

Procedure

ActionImport

Procedure

NavigationProperties

Table

All RUD operations will be appropriately mapped to the resulting entity based on the SQL submitted to the OData translator.

Usage

Usage of an OData source is similar to a JDBC translator. The metadata import is supported through the translator. Once the metadata is imported from the source system and exposed in relational terms, this source can be queried as if the EntitySets, FunctionImports and ActionImports were local to the CData Virtuality system.

You can connect OData as a data source.

Examples

1. OData V4 data source based on the TripPin service on http://odata.org:

SQL
CALL "SYSADMIN.createConnection"("name" => 'odata4_TripPinService',
  "jbossCLITemplateName" => 'ws',
  "connectionOrResourceAdapterProperties" => 'EndPoint=https://services.odata.org/V4/TripPinService'
);;

CALL "SYSADMIN.createDataSource"(
  "name" => 'odata4_TripPinService',
  "translator" => 'odata4'
);;

2. OData V4 data source based on the CData Virtuality Server data source:

SQL
CALL "SYSADMIN.createConnection"(
	"name" => 'odata4_mysql_adworks',
	"jbossCLITemplateName" => 'ws',
	"connectionOrResourceAdapterProperties" => 'EndPoint=http://localhost:8080/odata4/datavirtuality/mysql_adworks,SecurityType=HTTPBasic,AuthUserName=<user name>,AuthPassword=<user password>'
); 

CALL "SYSADMIN.createDataSource"(
	"name" => 'odata4_mysql_adworks',
	"translator" => 'odata4'
);

Please note that:

  • the mysql_adworks data source must be created on the CData Virtuality Server before creating the OData data source;

  • the mysql_adworks data source must be created with the importKeys import property set to TRUE. Only tables with primary keys are shown in the OData data source.

You can SELECT, INSERT, UPDATE, and DELETE data from the tables:

SQL
SELECT * FROM "odata4_mysql_adworks.addresstype";;

INSERT INTO odata4_mysql_adworks.addresstype VALUES(10, 'Secondary', 'C0D24191-4EA2-4FE2-AF7A-72C28BE68935', now());;

UPDATE odata4_mysql_adworks.addresstype SET Name = 'Stock' WHERE AddressTypeID = 10;;

DELETE FROM pg_big_tables.big_table_pk WHERE AddressTypeID = 10;;

Limitations

  • CREATE, DROP, SELECT INTO are not supported;

  • OData functions and actions are not fully supported at present;

  • Any type of JOIN is not pushed down;

  • LIMIT is not pushed down for V4.

For OData interface limitations, see the ‘Limitations’ section on the dedicated page in the User Guide.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.