Build a DB2 for z/OS Mobile Application

31
Build a DB2 for z/OS Mobile Application Jane Man, IBM Session Code: AP7 Thursday, Sept 17 11:15am – 12:15pm Platform: DB2 for z/OS

Transcript of Build a DB2 for z/OS Mobile Application

Page 1: Build a DB2 for z/OS Mobile Application

Build a DB2 for z/OS Mobile ApplicationJane Man, IBM

Session Code: AP7

Thursday, Sept 17 11:15am – 12:15pm

Platform: DB2 for z/OS

Page 2: Build a DB2 for z/OS Mobile Application

Please note

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 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.

Page 3: Build a DB2 for z/OS Mobile Application

Agenda

• Mobile Architecture

• System z – the best platform for mobile apps and data

• IBM MobileFirst

• 2 working use cases• Calling a SQL statement

• Calling a stored procedure

• Summary

3

Page 4: Build a DB2 for z/OS Mobile Application

System z information management End-to-End Architecture for Mobile and Cloud Application invoking z Services using APIs

Previously known as : IBM Worklight

Page 5: Build a DB2 for z/OS Mobile Application

Agenda

• Mobile Architecture

• System z – the best platform for mobile apps and data

• IBM MobileFirst

• 2 working use cases• Calling a SQL statement

• Calling a stored procedure

• Summary

5

Page 6: Build a DB2 for z/OS Mobile Application

6

From the complexity of many…

Multiple sets of tools & frameworks Four codebases to develop and maintain

To the simplicity of one

One development environment One codebase to develop and

maintain

IBM Worklight

AndroidApple

Windows

PhoneAndroidApple

Blackberry

Blackberry

IBM MobileFirst Platform – Integrated development and continuous delivery of mobile applications

Page 7: Build a DB2 for z/OS Mobile Application

IBM MobileFirst 7 Studio

• Native applications for• iOS

• Android

• Windows Phone 8

• Windows 8

• Hybrid development

• Server-side development(adapters)• SQL Adapter

• HTTP adapters

• Java adapters

• ……

• Mobile Console Browser

• …much more7

MobileFirst Server

Adapter 1

Adapter 2

….

Enterprise

(back end)

Database

Web services

….

Page 8: Build a DB2 for z/OS Mobile Application

IBM MobileFirst Development Environment

MobileFirst Platform Studio -Eclipse plugin

8

Command line interface (alternative to Studio)

Page 9: Build a DB2 for z/OS Mobile Application

MobileFirst Plaform Developer Studio – Installation

• JRE 7 (Note: Oracle JRE 7 is required for developing Android native app)

• Install Eclipse IDE for Java EE Developers installed: Juno SR2 (4.2.2), Kepler SR1 (4.3.1), Kepler SR2 (4.3.2), Luna SR1 (4.4.1), or Luna SR2 (4.4.2) Third Topic

• Start Eclipse, and then select Help > Eclipse Marketplace.

• In the Find field, type “MobileFirst Platform” and click Go. • In the Find field, type “MobileFirst Platform” and click Go.

• Optional : IBM Dojo Mobile Tools and IBM jQuery Mobile Tools

• JCC driver (DB2 connect)

• (Optional) Android development : Android SDK, ADT Eclipse plug-in, creating Android Virtual Device

(https://developer.ibm.com/mobilefirstplatform/install/#studio)9

Page 10: Build a DB2 for z/OS Mobile Application

Agenda

• Mobile Architecture

• System z – the best platform for mobile apps and data

• IBM MobileFirst

• 2 working use cases• Calling a SQL statement

• Calling a stored procedure

• Summary

10

Page 11: Build a DB2 for z/OS Mobile Application

Use Case 1: SQL statementFind string from string id in SYSIBM.SYSXMLSTRINGS table

11

SELECT STRINGID, SUBSTR(STRING,1,60), IBMREQD

FROM SYSIBM.SYSXMLSTRINGS;

Page 12: Build a DB2 for z/OS Mobile Application

Client development using studio

• Create a new MobileFirst Project: File>New>MobileFirst Project, select “Hybrid Application”

12

index.html

main.js

Page 13: Build a DB2 for z/OS Mobile Application

Sever side Pre-req for SQL adapterAdd DB2 info to server.xml

13

sever.xml

Page 14: Build a DB2 for z/OS Mobile Application

Server Side development – Creating a SQL Adapter

• File>New>MobileFirst Adapter

14

Hello2DB2Adapter.xml

Page 15: Build a DB2 for z/OS Mobile Application

Creating a SQL Adapter – cont’dHello2DB2Adapter-impl.js

• deploy a adapter: Right-Click the adapter>Run As>Deploy MobileFirst Adapter

• Test a adapterRight-Click the adapter>Run As>Call MobileFirst Adapter

Page 16: Build a DB2 for z/OS Mobile Application

Test a SQL Adapter

Right-Click the adapter>Run As>Call MobileFirst Adapter

Result:

What is this?

Page 17: Build a DB2 for z/OS Mobile Application

How to use the adapter result?

main.js

Page 18: Build a DB2 for z/OS Mobile Application

Build all Environments

• Right click <apps>Run As>Build All Environments

• Select iPhone, iPad, Android phones and tablets

18

Page 19: Build a DB2 for z/OS Mobile Application

MobileFirst Console

• Right Click <project> > Open MobileFirst Console

19

Page 20: Build a DB2 for z/OS Mobile Application

MobileFirst Console (cont’d)

20

Page 21: Build a DB2 for z/OS Mobile Application

Run on Android Native Emulator

• (require Android SDK, ADT Eclipse plug-in, creating Android Virtual Device)

• Right Click <project><apps>Android>Run As>Android Application

21

Page 22: Build a DB2 for z/OS Mobile Application

Use Case 2:Calling a Stored Procedure

22

RUNSTATS

Page 23: Build a DB2 for z/OS Mobile Application

RUNSTATS – SQL adapter

23

RunstatsSQLAdapter.xml

RunstatsSQLAdapter-impl.js

Page 24: Build a DB2 for z/OS Mobile Application

Call external REST API – Yahoo Weather API(i.e. SQL Adapter is NOT needed)

24

Main.js

Page 25: Build a DB2 for z/OS Mobile Application

Call external REST API – Yahoo Weather API – cont’d

25

Page 26: Build a DB2 for z/OS Mobile Application

Pitfalls – Oops!

26

Java 8

SELECT

SYSTOOLS.BSON2JSON(DATA)

from JSONPO WHERE ID= 101

SELECT XMLPO from

XMLT1 WHERE ID= 1

SELECT XMLCAST(

XMLQuery('/PO/items/item[1]/productName'

passing XMLPO) as VARCHAR(25))

from XMLT1 WHERE ID= 1

SELECT JSON_VAL(DATA,

'PO.items.item.0.productName', 's:20')

from JSONPO WHERE ID= 101

Page 27: Build a DB2 for z/OS Mobile Application

Agenda

• Mobile Architecture

• System z – the best platform for mobile apps and data

• IBM MobileFirst

• 2 working use cases• Calling a SQL statement

• Calling a stored procedure

• Summary

27

Page 28: Build a DB2 for z/OS Mobile Application

28

28

Summary

DB2 for z/OS is the perfect

environment for developing a

mobile transaction and

analytics integrated solutions

IBM MobileFirst provides an

integrated framework to

develop and test of DB2 for

z/OS mobile applications.

Page 29: Build a DB2 for z/OS Mobile Application
Page 30: Build a DB2 for z/OS Mobile Application
Page 31: Build a DB2 for z/OS Mobile Application

Jane [email protected]

Build a DB2 for z/OS Mobile ApplicationAP7

Please fill out your session

evaluation before leaving!