Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

SQLAnywhere 16.0 and Odata

2,027 views

Published on

OData is becoming the "Lingua Franca" for data exchange across the internet. Serve up OData web services from most relational database backends requires a web server and 3rd-party custom components that translate OData calls into SQL statements (and vice-versa). SQLAnywhere 16.0 introduced a new OData Producer that does all this work for you automatically. This session will walk throught the setup and configuration of this new server process, and show real world examples on how to use it.

Published in: Technology
  • Be the first to comment

SQLAnywhere 16.0 and Odata

  1. 1. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 -ISUG TECH 2015-ISUG TECH 2015 ConferenceConference .OData Support in SQL Anywhere 16 0.OData Support in SQL Anywhere 16 0 . -Paul A Horan SAP. -Paul A Horan SAP
  2. 2. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 AgendaAgenda  &Overview Introductions  .OData and SQLAnywhere 16 0 Live Demonstration  & ( )Questions hopefully Answers
  3. 3. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 OVERVIEW & INTRODUCTIONSOVERVIEW & INTRODUCTIONS
  4. 4. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 .Paul A Horan.Paul A Horan Former 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
  5. 5. (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 center Main 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/Unattende d Systems Point of Business
  6. 6. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 What is the ODataWhat is the OData Protocol?Protocol? In the ….Beginning Mainframe 60’s – 70’s Client/Server 80’s – 90’s Web Architecture 90’s – 00’s
  7. 7. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 What is the ODataWhat is the OData Protocol?Protocol? And Today… Mobile Desktop Internet of Things Web Apps
  8. 8. (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_id cust_name FROM customer WHERE = ‘ ’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
  9. 9. (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 •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
  10. 10. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 ARCHITECTURAL OVERVIEWARCHITECTURAL OVERVIEW
  11. 11. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 /SOAP REST support in/SOAP REST support in SQLASQLA SQL Anywhere Server DB #1 Client AppODBC/JDBC TCP/IP HTTP/s Client AppSOAP/REST HTTP/s DB #2 XML 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 objects CREATE 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 § §
  12. 12. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 .SQL Anywhere 16 0.SQL Anywhere 16 0 ArchitectureArchitecture SQL Anywhere Server DB #1 DB #2 DBOSRV16 OData Producer HTTP/S JDBC 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
  13. 13. (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
  14. 14. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 LET’SSEE A DEMONSTRATIONLET’SSEE A DEMONSTRATION
  15. 15. (c) 2015 Independent SAP Technical User GroupAnnual Conference, 2015 QUESTIONS& ANSWERSQUESTIONS& ANSWERS
  16. 16. Annual Conference, 2015 (c) 2015 Independent SAP Technical User Group Questions and AnswersQuestions and Answers
  17. 17. Annual Conference, 2015 (c) 2015 Independent SAP Technical User Group Thank You for AttendingThank You for Attending Please complete yourPlease complete your session feedback formsession feedback form

×