This article will first briefly introduce OData, a web API for data access. This document describes how to use OData for IBMDB2forLinux, UNIX, andWindows, DB2forzOS, and DB2forInformix. Finally, this article provides
This article will first briefly introduce OData, a Web API for data access. This document describes how to use OData for IBM DB2 for Linux, UNIX, and Windows, DB2 for z/OS, and DB2 for Informix. Finally, this article provides
OData (see references for more information) is a specification for data access to Web APIs, designed to make tables and other resources accessible from Web browsers and mobile devices. OData specifies the creation, reading, updating, deletion (CRUD) and query of resources (data or applications) through HTTP. It also specifies the format of the result to ATOM (XML) and JSON. OData is similar to a Web-based micro ODBC or JDBC. More accurately, OData allows the client to construct a URI to name an object set, filter the objects it contains, and traverse the relationship between the related entities and object sets.
Figure 1 shows how to publish DB2 or Informix on the Web using ADO. Net support. Microsoft Visual Studio provides some tools to make database data public on the Web through HTTP. Database data can be created, updated, deleted, and queried from Web browsers and other OData use programs using the OData syntax.
Figure 1. OData Overview
Figure 2 shows the CSDL (Conceptual schema definition language), which is an XML representation that describes basic resources using an object-link model that can be accessed through OData.
Figure 2. CSDL (conceptual mode definition language)
CSDL is often used in development, for example, in a tool or model er. CSDL is optional and generated by Visual Studio to help your applications understand the structure of public data. Similar to the metadata in JDBC and ODBC, CSDL helps client applications understand what they access.
Use OData on the Web to publish tables in the sample database
The following sections detail how to perform the following operations.
- Execute initial settings, such as defining database connections.
- Create an ADO. Net Entity model.
- Select the DB2 table that will be exposed through OData.
- Create an OData Service (WCF Service) for the selected table ).
- Test the OData service.
This description is used when OData is merged into Microsoft Visual Studio. However, after testing the support in Visual Studio, you can use other OData runtime.