DB2 REST API and z/OS Connect –
SQL/Stored Procedures Play a Role in Mobile
and API Economics
Maryela WeihrauchIBM Distinguished Engineer –
z Systems Analytics WW Technical Sales and Client Champion
Please Note
• IBM’s statements regarding its plans, directions, and intent are subject to change orwithdrawal 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 may not be incorporated into any contract.
• The development, release, and timing of any future features or functionality described for our products remains at our sole discretion.
Performance is based on measurements and projections using standard IBM benchmarks in a controlled environment. The actual throughput or performance that any user will experience will vary depending upon many factors, including considerations such as the amount of multiprogramming in the user’s job stream, the I/O configuration, the storage configuration, and the workload processed. Therefore, no assurance can be given that an individual user will achieve results similar to those stated here.
Acknowledgements and Disclaimers
Availability. References in this presentation to IBM products, programs, or services do not imply that they will be available in all countries in which IBM operates.
The workshops, sessions and materials have been prepared by IBM or the session speakers and reflect their own views. They areprovided for informational purposes only, and are neither intended to, nor shall have the effect of being, legal or other guidance or advice to any participant. While efforts were made to verify the completeness and accuracy of the information contained in this presentation, it is provided AS-IS without warranty of any kind, express or implied. IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, this presentation or any other materials. Nothing contained in this presentation is intended to, nor shall have the effect of, creating any warranties or representations from IBM or its suppliers or licensors, or altering the terms and conditions of the applicable license agreement governing the use of IBM software.
All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved. Actual environmental costs and performance characteristics may vary by customer. Nothing contained inthese materials is intended to, nor shall have the effect of, stating or implying that any activities undertaken by you will result in any specific sales, revenue growth or other results.
© Copyright IBM Corporation 2014. All rights reserved.
— U.S. Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
IBM, the IBM logo, ibm.com, DB2, DB2 Connect and z/OS Connect are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries, or both. If these and other IBM trademarked terms are marked on their first occurrence in this information with a trademark symbol (® or TM), these symbols indicate U.S. registered or common law trademarks owned by IBM at the time this information was published. Such trademarks may also be registered or common law trademarks in other countries. A current list of IBM trademarks is available on the Web at
“Copyright and trademark information” at www.ibm.com/legal/copytrade.shtml
What to Expect
• Understand the current trend of API economics
• Learn how z/OS Connect provides a consistent REST(JSON) interface into z/OS
• Learn how DB2 exploits z/OS Connect to REST(JSON) enable SQL and Stored Procedures
API Economy – the Bigger Picture
Brief History of APIs
source: http://dupress.com/articles/tech-trends-2015-what-is-api-economy/
APIs – the Building Blocks for Apps
Provider Benefits
• Expanding into new customer base and niches that you normally wouldn’t be able to reach
on your own
• Focusing on core value
• Easier possibilities in establishing new partnerships and capitalizing on them
• Benefitting from open innovations of crowdsourcing and expert sourcing which are
implicitly unlocked through the opening of APIs
• Realize profit from new business models
• Decreasing development costs and time through software produced by third parties
• Keeping up with application demand (new apps, new features)
Benefits for Application Assemblers
• Quick time to market by using existing assets and services to decrease cost and
speed up product and service development
• Driving innovation by capitalizing on the merging of capabilities provided by different
APIs
• Attracting clients to your products and services by joining other (established) API
ecosystems
• Potentially having freedom of choice in terms of available APIs
• Focus on core competence and value add rather than re-inventing common
capabilities
• Innovate around business models and reach new customers from the provider’s
ecosystem
CICS
IMS
WebSphere
DB2
MobileFirst
Platform
(cloud)
z/OS Connect Enterprise Edition (EE) V2.0
12
z/OS Connect EE
API
APIAPI
• Provides “System APIs” creation for z/OS subsystem applications
• Delivers RESTful APIs as a discoverable, first-class resource with OpenAPI Spec (Swagger 2.0) descriptions
• Ready for consumption by today's enterprise application developers and integration with API management solutions
• Swagger specification
• Comprehensive tooling that enables API developers to create RESTful APIs from z/OS-based assets
• Supports standard JSON message format and conversion to z/OS subsystem backend format requirements
13
Simplified Overview of REST/JSON
REST
Client
REST
Listener
POST /account/deposit
{
"account" : "12345"
"amount" : "100.00"
}
CICS, IMS, DB2,
or wherever
account data is
maintained
Response
REST - “Representational State Transfer” ... which uses HTTP and HTTP verbs to allow a
client to interact with a server over the TCP/IP network.
JSON - “JavaScript Object Notation” ... a name/value pair representation of data that is
relatively lightweight and generally simpler to handle and parse than XML.
REST is increasingly popular as an integration pattern because it is stateless,
relatively lightweight, is relatively easy to program
GET /account/balance
IBM z/OS Connect Enterprise Edition V2.0
z/OS Connect EE Structure Today
z/OS Connect
EE
Data
Conversion
Discovery
Function
Audit
FunctionLogging
Function
Granular
Authorization
CICS
IMS
DB2(z/OS Connect V1)
Task
REST
REST
JSONSuch as a WAS z/OS server
hosting REST or 3rd party
Batch using WOLA APIs to
host a service
Embedded or as
started task
Via IMS Connect
Type 2 or 4 JDBC
MQ* (beta)
14
* http://www.slideshare.net/MattLeming/hhm3481-ibm-mq-for-zos-enhancing-application-and-messaging-connectivity-in-a-hybrid-world
Service Provider
z/OS Connect Discovery Function
15
DB2 Adapter for z/OS Connect 1.1
DB2 Adapter for z/OS Connect Overview
• DB2 Adapter for z/OS Connect is an integrated solution that enables developers to make
existing DB2 assets – SQL and Stored Procedures – available in today’s growing mobile
and cloud application ecosystem
• Consists of 3 components
– WLP with z/OS Connect 1.1 license
– DB2 Adapter for z/OS Connect
– IBM Data Studio, V4.1.2
http://www.ibm.com/developerworks/downloads/im/data/
• DB2 Adapter for z/OS Connect ships via DB2 Accessories Suite for z/OS, V3.3
(5697-Q04)
– Functionality of DB2 10 and DB2 11
– Some WLP skill preferred for install and configuration
17
Demo
• Data Studio tooling for creating and deploying DB2 Adapter for z/OS
Connect services
• DB2 REST Service discovery
• DB2 REST Service invocation
Data Studio Tooling for z/OS Connect –End to End Development
Data Web Services
of Data Studio (later planned in RDz)
Deploy to remotezOS Connect
DB2z/OS
Connect
Database operations
z/OS Connect artifacts
z/OS Connect on LPAR
1. Define z/OS Connect together
with Database connection
User Interface
2. Define a new service by right click
on Web Services folder
User Interface
3. Drag ‘n drop 4. Right click to Deploy in
z/OS Connect
Service definitions are deployed in z/OS Connect – ready to use
DB2 Adapter for z/OS Connect 1.1 - Architecture
22
lBueMixz/OS Connect
and DB2 Adapter JSON to/from
SQL/CALL
Via JCC
Type2 or Type4
WAS Liberty z/OS
RESTful
RESTful
RESTful
zConnect
A service that encapsulate calling z/OS target applications using REST calls.
zConnect will support JSON payloads for calls from external cloud or mobile-
based clients and will enable the conversion of the payload to the target
program's expected format. It will also provide the response payload conversion
from a byte array into JSON format before returning the response to the caller.
Data transformation /
routing
Mobile/
APIM Security / Auditing / Metering
CloudOEJavascript
CloudOE
JavaSQL
Stored Procedure
z/OS Connect address space is coupled with a single DB2 system
Security and Authorization Consideration
z/OS Connect DB2JCC
SAF Admin group
DB2AdapterDeploy
Service
SAF Operations group
Start/stop service
SAF Invoke group
UserService1(
invokegroup)
UserService2(
invokegroup)
…..
DataStudio
Userid, used to
connect to z/OS
Connect needs admin
auth to define a
service using
DB2Deploy Service.
It becomes service
owner under which
the SQL of the
UserService is
executed in DB2
Userid, used to
connect to z/OS
Connect needs invoke
auth to invoke a
UserService .
Functional Userid to
establish a connection
to DB2.
SQL will be executed
under userid of
service owner
https
https
DB2 Trusted Context support will be used to switch from the Functional Userid to the service
owner Userid for invoke processing
Installation and Configuration
• The DB2 Adapter for z/OS Connect functionality does not run “in” DB2.
• Runs under the IBM Liberty Profile for z/OS application server runtime environment.
• Although we will include DB2 Adapter for z/OS Connect specific Liberty Profile for z/OS
server “templates” to aid in server creation and customization, the installation will easier for
someone with some prior “WebSphere” installation and configuration skills.
• Much of the customization is performed by modifying the Liberty Profile for z/OS
“server.xml” and associated files.
• Installation and configuration will also require coordination with SAF security administrator
to create z/OS Connect security groups, etc.
Native DB2 RESTful service support
DB2 11 NFM Apar PI66828 & PI70477
Motivation for Integrated Solution in DB2
DB2 integrated REST API functionality maintaining z/OS Connect externals as
applicable for
• Reuse of DDF functionality that provides a highly available, highly scalable and
highly serviceable network interface
• Support of clientInfo fields
• DDF provides security, auditing, and data transformation as being provided using
z/OS Connect
• PERMIT DSN.REST CLASS(DSNR) ID(DB2USER) ACCESS(READ)
• DDF Rest API would be ready out of the box
• Allows a database administrator to manage services
• New catalog table
• Static execution pattern – auth checking, object dependency tracking
RESTful Service Support in DB2
RESTful
JSON
DB2 z/OSDDF
DRDA DRDA
parsing
Auth
check
Thread
Creation/
SQL
execution
REST API
https and
JSON
parsing
Data
Server
Client
Application
z/OS Connect
EE
REST API
REST API
Native DB2 REST API Support
• Create|DROP|START|STOP Service using either Data Studio v1 support, or direct DB2
DDF REST API
– Sample
POST https://<host>:<port>/services/DB2ServiceManager
{"requestType": "createService«....}
• Discover all services and discover details for a specific service using direct DB2 DDF
REST API
POST https://<host>:<port>/services/DB2ServiceDiscover
{ ["collectionID": "<collectionID>"]
• DB2 REST Service invocation.
– DB2 Adapter for z/OS Connect V1 invocation API syntax
– New direct DB2 DDF REST invoke API.
• Supported INSERT, UPDATE, DELETE and cursor based SELECT
• CALL support with IN/OUT/INOUT parameters und resultsets
• All of the various DB2 base SQL types
29
References/Blogs to read
• The easiest way on the planet to create RESTful Web Services!
• Setup SSL and client cert authentication
http://www.redbooks.ibm.com/redpapers/pdfs/redp4799.pdf
http://www.redbooks.ibm.com/redbooks/pdfs/sg248099.pdf (chapter 12)
30
Maryela Weihrauch
IBM
Session A6
Title
DB2 Adapter for z/OS Connect –
SQL/Stored Procedures Play a Role
in Mobile and API EconomicsPlease fill out your session
evaluation before leaving!
Top Related