restapi and json use case scenarios - db2-aktuell.de and... · db2 aktuell 2017 2 ibm’s...
TRANSCRIPT
Db2 Aktuell 2017
REST API / JSON Use Case ScenariosOliver Draese, STSM Db2 for z/OS DevelopmentIBM Silicon Valley Lab ([email protected])
Db2 Aktuell 2017
2
IBM’s statements regarding its plans, directions and intent are subject to change or withdrawal without notice at IBM’s sole discretion. Information regarding potential future products is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information mentioned regarding potential future products is not a commitment, promise, or legal obligation to deliver any material, code or functionality. Information about potential future products many not be incorporated into any contract. The development, release, and timing of any future features or functionality described for our product remains at our sole discretion.
DisclaimerDisclaimer
Db2 Aktuell 2017
3
Worum geht es?
§ Db2 ist nun selbst ein RESTful Service Provider§ Einfache Integration von Enterprise Data in neue APIs oder
Anwendungen§ Statisches SQL mit modernem Interface§ Unabhängig von verwendeten Programmiersprachen§ DBA hat volle Kontrolle über das hinterlegte SQL
Db2 Aktuell 2017
4
API API
API
API Connect
IBM Watson
API API
API
Db2 Aktuell 2017
5
Die verschiedenen Lösungen in der Übersicht
Db2 liefert als Service Provider Zugriff auf Enterprise Daten. Existente SQL Applikationen können modernisiert werden. Daten können einfach mit anderen API integriert werden!
Db2
z/OS Connect implementiert Industrie Standards (OpenAPIInitiative) und erlaubt durch seine mehrschichtige Architektur einen vereinheitlichten Zugangspunkt zu z/OS mit EAL5+ Sicherheit.
API Connect ist eine umfassende API Management Schicht für Authentifizierung und Token Management, Monitoring, Throttling und Abrechnung.
API Connect
Db2 Aktuell 2017
6
Db2 als Service Provider
Eingebaute Management Services:Anlegen, auflisten, ausführen von Services, ebenfalls via REST API
DDFService Discovery
Service CreationService Invoc.
Access Control (SAF)Security & Auditing
SQLPackage
z/OSConnect
Data Studio
RESTfulJSON
HTTP
DDF
Db2 Aktuell 2017
7
Db2 als Service Provider
Anlegen von neuen Services:Ein einzelnes SQL Statement (INSERT, UPDATE, DELETE, SELECT, CALL) in ein eigenes Package gebunden
DDFService Discovery
Service CreationService Invocation
Access Control (SAF)Security & Auditing
SQLPackage
z/OSConnect
Data Studio
RESTfulJSON
HTTP
DDF
Db2 Aktuell 2017
8
Db2 als Service Provider
Zugriffskontrolle:Existente DDF Infrastruktur für Klassifizierung, Sicherheit, Accounting, Statistics, Auditing
DDFService Discovery
Service CreationService Invocation
Acc. Control (SAF)Security & Auditing
SQLPackage
z/OSConnect
Data Studio
RESTfulJSON
HTTP
DDF
Db2 Aktuell 2017
9
Db2 als Service Provider
Eingebettet in DDF:DDF beantwortet nun auch die HTTP Requests, formatiert die JSON Ausgaben und startet das statische SQL Statement. Dabei werden Thread Pooling, Profiling... genauso genutzt wie bei „traditionellem“ DDF.
DDFService Discovery
Service CreationService Invocation
Access Control (SAF)Security & Auditing
SQLPackage
z/OSConnect
Data Studio
RESTfulJSON
HTTP
DDF
Db2 Aktuell 2017
10
Db2 Service mit DataStudio anlegen...1. SQL Statement schreiben 2. Statement als Service anlegen
3. Service registrieren (Deploy)4. Service Aufruf testen
Db2 Aktuell 2017
11
...oder einfach via REST Calls
Db2 Aktuell 2017
12
...oder einfach via REST Calls
Db2 Aktuell 2017
13
…oder via UI für MacOS
https://github.com/draese/DB2-for-zOS-REST-Manager
Db2 Aktuell 2017
14
...oder via BIND Command
BIND SERVICE(collid) NAME(service_name) [SQLDDNAME(ddname)] [SQLENCODING()] DESCRIPTION('string') [Additional BIND options]
*voraussichtlich November 2017
Db2 Aktuell 2017
15
Beispiel: AngularJS, NodeJS & Db2AngularJS / HTML5 Node Server App
Sichere ZoneDMZClient / Offene Zone
HTTP HTTP
https://github.com/draese/Db2RESTSample
Db2 Aktuell 2017
16
Beispiel: AngularJS, NodeJS & Db2AngularJS / HTML5 Node Server App
HTTP HTTP
https://github.com/draese/Db2RESTSample
Db2 Aktuell 2017
17
Beispiel: AngularJS, NodeJS & Db2AngularJS / HTML5 Node Server App
Node Server liefert die Web Seite und den Angular JavaScript Code.
1
Db2 Aktuell 2017
18
Beispiel: AngularJS, NodeJS & Db2AngularJS / HTML5 Node Server App
Angular View fordert Daten via „Relay“ REST Service „getEmpData“ an
2
http://localhost:3000/getEmpData
Db2 Aktuell 2017
19
Beispiel: AngularJS, NodeJS & Db2AngularJS / HTML5 Node Server App
NodeJS REST Service fordert die “Rohdaten“ via REST POST bei Db2 an.
3
http://server:446/services/birthDayList
Db2 Aktuell 2017
20
Beispiel: AngularJS, NodeJS & Db2{ "ResultSet Output": [ { "firstName": "CHRISTINE", "lastName": "HAAS", "bDay": "1933-08-14"
}, { "firstName": "MICHAEL", "lastName": "THOMPSON", "bDay": "1948-02-02"
}, ... ],
"StatusCode": 200, "StatusDescription": "Execution Successful“
}
4
http://server:446/services/birthDayList
Db2 Aktuell 2017
21
Beispiel: AngularJS, NodeJS & Db2
[ { firstName: "Christine",
lastName: "Haas", bDay: "1933-08-14", age: 83},
{ firstName: "Michael", lastName: "Thompson", bDay: "1948-02-02", age: 69},
...]
AngularJS / HTML5
5
http://localhost:3000/getEmpData
Db2 Aktuell 2017
22
Beispiel: AngularJS, NodeJS & Db2
<tbody> <tr ng-repeat="emp in empData">
<td>{{emp.firstName}}</td> <td>{{emp.lastName}}</td> <td>{{emp.bDay}}</td> <td>{{emp.age}}</td>
</tr></tbody>
AngularJS / HTML5Angular generiert die Tabellen – Zeilen basierend auf dem JSON Objekt Array...
Db2 Aktuell 2017
23
Demo
Db2 Aktuell 2017
24
Integration mit z/OS Connect EE
Data Web Servicesin Data Studio
Db2
SQL Statement
Db2 REST ServiceJSON Request undResponse Schemas
POST http://<host>:<port>/services/DB2ServiceManager{“requestType”:“createService“, “serviceName”:“EmployeeLookup“,“sqlStmt”:”select * from employee where empno=:empno”,“description”:”Query employee for the input empno”
}
ViaDB2ServiceManager
API
Db2ServiceDiscover API
zCEE Service Archive Toolkit
(zconbt)zCEE Service Archive (SAR)
Datei
Db2 Aktuell 2017
25
APARs für Db2 V11 und V12
25
DB2 V11 APARs• PI66828 - Initiale Version. Einschränkungen: Kein LOB/XML, Keine SP ResultSets, ...• PI70477 (Ähnlich wie Db2 V12 PI70652) – Erster Db2 V11 Service Refresh. Db2 V11 GA Version.• PI74409 (Ähnlich wie Db2 V12 PI74515) – Verschiedene Fehlerbehebungen• PI80087 (Ähnlich wie Db2 V12 PI80088) – Unterstützung für Db2 Trusted Contexts. Fehlerbehebungen für
SSL Client Certificate Authentifizierung, Benennung von Ergebnisspalten, …
DB2 V12 APARs• PI70652 (Ähnlich wie Db2 V11 PI70477) – Erster Db2 V12 Release (DB2 V12 "GA" level).• PI74515 (Ähnlich wie Db2 V11 PI74409) - Verschiedene Fehlerbehebungen• PI80088 (Ähnlich wie Db2 V11 PI80087) – Unterstützung für Db2 Trusted Contexts. Fehlerbehebungen für
SSL Client Certificate Authentifizierung, Benennung von Ergebnisspalten, …
Db2 Aktuell 2017
26
Videos und Demo Code
§ Db2 11 and 12 for z/OS Native REST Services – Part #1Demo, wie Db2 REST Services angelegt werden könnenhttps://youtu.be/6XkiEysnsCg
§ Db2 11 and 12 for z/OS Native REST Services and z/OS Connect EE 2.0 – Part #2Video über die Erweiterung von Db2 REST Services mit z/OS Connect EE 2.0. https://youtu.be/91ji0w01E3A
§ Demo Code dieser Db2 Aktuell Sessionhttps://github.com/draese/Db2RESTSample
Db2 Aktuell 2017
27
DB212rulestheAPIEconomy
TheRESTfulAPIisyetanotherwaywhereDB2isattheleadingedge– andagaincementingDB2’sandthemainframespositionasafullcapableserverintheITinfrastructureoftoday.UsingtheseREST-servicesMobileapplicationscanbothbebuiltfasterandrunfaster!
Frank PetersenChief Architect BankData
DB2 12 – RESTful API helping enterprises to be Agile
“RestfulAPIinDB212forz/OSallowsyoutodevelopmobileandotherappswithscalableperformanceinamatterofminutes.Doyouwanttobequickandagile?UseRestfulAPIinDB212forz/OS”
Kurt Struyf IBM GOLD Consultant IBM Champion for Analytics
Kundenzitate
Db2 Aktuell 2017
28
Danke!Oliver Draese
STSM, Db2 for z/OS Development, IBM Silicon Valley Lab
[email protected]://www.linkedin.com/in/draese