SQLAnywhere 16.0 and Odata

17
(c) 2015 Independent SAP Technical User Group Annual Conference, 2015 - ISUG TECH 2015 - ISUG TECH 2015 Conference Conference . OData Support in SQL Anywhere 16 0 . OData Support in SQL Anywhere 16 0 . - Paul A Horan SAP . - Paul A Horan SAP

Transcript of SQLAnywhere 16.0 and Odata

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

- ISUG TECH 2015- ISUG TECH 2015ConferenceConference .OData Support in SQL Anywhere 16 0 .OData Support in SQL Anywhere 16 0

. - Paul A Horan SAP . - Paul A Horan SAP

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

AgendaAgenda

& Overview Introductions .OData and SQLAnywhere 16 0 Live Demonstration & ( ) Questions hopefully Answers

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

OVERVIEW & INTRODUCTIONSOVERVIEW & INTRODUCTIONS

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

. Paul A Horan . Paul A HoranFormer Presales Solution Engineer for Sybase Tools

•PowerBuilder, PowerDesigner, SQL Anywhere, SUP, Afaria

TeamSybase member (2000-2012)

Sybase developer/evangelist since 1991

Now: Director of Global Presales Enablement for SAP Mobility (SMP/HCPms, Mobile Secure, Fiori)

Based in Washington, DC area

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

What is SQL Anywhere? What is SQL Anywhere?Enterprise-class data management and synchronization solution

Designed for apps that operate outside the traditional data centerMain Features:

• Feature-rich DBMS

• Scalable from devices to multi-CPU hardware

• Easy synchronization with remote nodes via MobiLink

• Small footprint, self-administering

• Cross-platform and binary-compatible

• Flexible deployment

Mobile & Remote Applications

Smart/Unattended Systems

Point of Business

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

What is the OData What is the ODataProtocol?Protocol?

In the….Beginning

Mainframe

60’s – 70’s

Client/Server

80’s – 90’s

Web Architecture

90’s – 00’s

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

What is the OData What is the ODataProtocol?Protocol?And Today…

Mobile

Desktop

Internet of Things

Web Apps

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

. OData vs SQL . OData vs SQL“ODBC for the Web”

Customer

cust_id integer

cust_name ( )varchar 20

address_1 ( )varchar 60

address_2 ( )varchar 60

city ( )varchar 50

state ( )varchar 2

SELECT , cust_idcust_nameFROM customerWHERE = ‘ ’state GA

ORDER BY ;cust_name ASC

SQL Query OData URL

HTTP GET:// . .http www mycompany com

/ /OData Customer_Database/Customer

= , ?$select cust_id cust_name& = ‘ ’$filter state eq CA& = $orderby cust_name ASC& =$format json

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

. OData vs SOAP . OData vs SOAP

•SOAP and WSDL- Highly structured

input/output- Input parms = Request- Output parms =

Response

- Exposes component methods

- Query defined at DESIGN time

- Can return complex structures as XML payload

•REST and OData- Freeform input/output

- Input parms = URL parameters

- Output parms = JSON document

- Exposes database artifacts

- Query defined at RUN time

- Can return complex structures as either XML or JSON

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

ARCHITECTURAL OVERVIEWARCHITECTURAL OVERVIEW

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

/ SOAP REST support in/ SOAP REST support inSQLASQLA

SQL Anywhere Server

DB #1

Client AppODBC/JDBC

TCP/IP

HT

TP

/s

Client AppSOAP/REST

HTTP/s

DB #2XML

PROS:

§Didn’t require an App Server

§All done in SQL – no Java or C#

§Single management console

§Supported both SOAP & REST

§Return formats:

§ XML

§ JSON

§ HTML

§ SOAP payload

§ RAW

§Standard URL for web access://< >/< >/<http servername db s

>vc

CONS:

§Services were separate objectsCREATE SERVICE "jsonEmployeeList" TYPE 'JSON' AUTHORIZATION OFF SECURE OFF USER DBA AS SELECT EmployeeID, SurName, GivenName, StartDate FROM Employees ;

§No linkage between db objects and service objects

§Exposed the database server outside the firewall!!!!

§ Separate cmdline switch

§ - xs( =HTTP port 808

)2§

§

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

. SQL Anywhere 16 0 . SQL Anywhere 16 0ArchitectureArchitecture

SQL Anywhere Server

DB #1

DB #2

DBOSRV16

OData Producer

HTTP/SJDBC

JSON Client App

New OData Producer process:

§Consists of two distinct components

1) HTTP/s Server

§ Jetty server and Java Servlet container

§ Manages requests from web clients

§ Manages JDBC connection pool to SA16

2) OData Producer servlet

§ Java servlet that connects to backend via JDBC

§ Translates OData requests into SQL/DML

§ Can run in ANY Java servlet container

§Can run as a separate Windows service

§Default behaviors:

§ Any table with a PK is exposed as an entity

§ All FK relationships become Associations

§Override the defaults with the .OSDL file

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

. OSDL file contents. OSDL file contents•service namespace "Northwind" {

• entity "DBA"."Categories" as "CategoryCollection" ;

•entity "DBA"."Customers" as "CustomerCollection" ;

• entity "DBA"."Alphabetical_list_of_products”keys("ProductID");

• entity "DBA"."Employees" as "EmployeeCollection”navigates ("ReportsTo" as "FK_Employees_Employees” from dependent);

•association "ReportsTo”principal "EmployeeCollection" ("EmployeeID”) multiplicity "0..1”dependent "EmployeeCollection" ("ReportsTo”) multiplicity "*”over "DBA"."Employees" principal ("EmployeeID") dependent ("ReportsTo") ;

•serviceop get "DBA"."CustOrderHist" as "CustOrderHist" returns multiplicity "*";

•}

•Specifically lists the Tables and Views to expose as OData entities

§ ENTITY statement§ With()/Without() to

include/exclude columns from the result set

§ Keys() specifies the PK column(s)

§ Navigates() defines an association

§ ASSOCIATION statement§ Defines the relationship

from the “dependent” to the “primary” entity

§ SERVICEOP statement§ Exposes a stored

procedure

§ Can be either a GET or a POST

§ Can return no result, a singleton, or a full resultset

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

LET’S SEE A DEMONSTRATIONLET’S SEE A DEMONSTRATION

(c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015

QUESTIONS & ANSWERSQUESTIONS & ANSWERS

Annual Conference, 2015 (c) 2015 Independent SAP Technical User Group

Questions and Answers Questions and Answers

Annual Conference, 2015 (c) 2015 Independent SAP Technical User Group

Thank You for Attending Thank You for Attending

Please complete your Please complete your session feedback form session feedback form