DB2 for z/OS and Java What’s New?
Julian StuhlerDB2Night Show
September 2011
Agenda
� Introduction
� Java Overview
� Java & DB2: Benefits and Challenges
� So, What’s New?
DB2Night Show ©© 2011 Triton Consulting Ltd
2
� So, What’s New?
� Conclusion & Summary
Your Presenter – Julian Stuhler
� DB2 consultant with Triton Consulting, based in the UK
� 25 years DB2 experience• Database Administration• Systems Programming• Application Development
IBM Gold Consultant
DB2Night Show ©© 2011 Triton Consulting Ltd
3
� IBM Gold Consultant� IBM Information Champion� IDUG Best Speaker� Redbook – DB2 Java Stored Procedures, Learning
by Example � IDUG Past President
Java Overview
DB2Night Show ©© 2011 Triton Consulting Ltd
What is Java?
� Java is a programming language
• Object oriented
• Derivative of C++ with simpler syntax and more robust memory management
• Code is compiled to architecture neutral byte-code
DB2Night Show ©© 2011 Triton Consulting Ltd
5
• Code is compiled to architecture neutral byte-code
• Secure –built-in controls for preventing malicious code
• Portable – device and OS independent
What is Java?
� Java is a runtime environment (aka platform) with 2 major components• A Java Virtual Machine (JVM), which
runs Java code and insulates it from underlying hardware / OS� Interprets portable Java byte code and JVMJava API
myProg.java
DB2Night Show ©© 2011 Triton Consulting Ltd
6
� Interprets portable Java byte code and translates to underlying platform-specific instructions
� Can be supplied by the web browser, operating system or middleware (such as Websphere Application Server)
• A Java API, which provides a collection of ready-made Java software components for common functions
Hardware / Operating System
JVMJava API
What is Java?
� Java is a development environment
• JDK (Java Development Kit) provides the tools necessary to develop and test a Java program
DB2Night Show ©© 2011 Triton Consulting Ltd
7
Java In The Enterprise
� IBM and other enterprise vendors have emphatically endorsed Java• Good fit with IBM’s “open” approach and On
Demand strategy
• Great counter to Microsoft’s .net
DB2Night Show ©© 2011 Triton Consulting Ltd
8
• Great counter to Microsoft’s .net
� Many organisations have adopted Java as the (or one of the) primary application development technologies• Good availability of skilled programming resource
• Portability
Java In The Enterprise
� Huge effort within IBM in recent years to support Java as a primary application development environment• Hardware support (IFL, zAAP, zIIP, zEnterprise)
• Operating System support (USS, Java SDK for
DB2Night Show ©© 2011 Triton Consulting Ltd
9
• Operating System support (USS, Java SDK for z/OS)
• Software licensing (IFL)
• Middleware development (DB2, Websphere, etc)
• Application development tools (Websphere studio, RAD, Eclipse)
• Consulting services
Java & DB2: Benefits and Challenges
DB2Night Show ©© 2011 Triton Consulting Ltd
Java & DB2: Benefits
� Good fit to each technology’s strengths• Java runs well on most “application server” hardware
platforms• DB2 offers best-of-breed data serving capabilities
(resilience, scalability, integrity)
� Availability of developer skills compared to “legacy” languages
DB2Night Show ©© 2011 Triton Consulting Ltd
Availability of developer skills compared to “legacy” languages• May change in future – see next slides…
� Portability� Mature DB2 driver architecture� Ongoing enhancements to DB2 to make it more
“Java friendly”
� Java programs can access DB2 data using the IBM Data Server Driver for Java with…
Java & DB2: Benefits
• … one of the Java database APIs
� JDBC
� SQLJ
� pureQuery
• … one of two Java connection interface calls
� DriverManager
� DataSource
DB2Night Show ©© 2011 Triton Consulting Ltd
12
� DB2 stored procedures and User Defined Functions can also be written in Java
� pureQuery
• … one of the two driver connection types
� Type 2 (local)
� Type 4 (remote)
pureQuery gives further options – see later
Java & DB2: Challenges
� JDBC = Dynamic SQL• Performance
• Response time consistency
• Authorisation
• Monitoring & Accounting (same package for all)
DB2Night Show ©© 2011 Triton Consulting Ltd
• Monitoring & Accounting (same package for all)
• DBM1 Virtual storage (MAXKEEPD)
� Developer skills
• Ironically, many educational establishments now consider Java to be an enterprise language, so it is becoming less fashionable to teach
13
Java & DB2: Challenges
� Impedance Mismatch• Java is an Object Oriented language
• Relational databases such as DB2 deal with tables and columns
• Mismatch requires mapping between the two
DB2Night Show ©© 2011 Triton Consulting Ltd
14
Customer
Customer
AddressTelephone Number
Customer Java Object Customer DB2 Tables
Java & DB2: Challenges
� Cultural Silos
• Many Java developers don’t know (or care) much about the way the back-end database operates – black box approach
DB2Night Show ©© 2011 Triton Consulting Ltd
operates – black box approach
• Many DBAs don’t understand Java/OO development (e.g. may come from a more traditional COBOL development background)
15
Java & DB2: Challenges
� Java Frameworks are designed to improve developer productivity• Provide standard functions/facilities
• Promote re-use
• Free the developer from directly coding lower-level
DB2Night Show ©
© 2011 Triton Consulting Ltd
• Free the developer from directly coding lower-level functions such as data access by adding (another) abstraction layer
� Data access frameworks (aka “persistence frameworks”) deal with access to relational databases
16
Java & DB2: Challenges
� Popular Java data access frameworks• iBatis
• Hibernate
• JDO
• JPA
DB2Night Show ©
© 2011 Triton Consulting Ltd
• JPA
• TopLink
� Many of these interoperate so multiple frameworks can be used at once• E.g. The Spring framework can use all of the
above data access frameworks17
Java & DB2: Challenges
� Framework issues
• Developer will use framework’s own query language, which will be used to generate SQL
• Potential performance issues
• Potential problem diagnosis issues
DB2Night Show ©© 2011 Triton Consulting Ltd
• Potential problem diagnosis issues
18
Break
DB2Night Show ©© 2011 Triton Consulting Ltd
19
So, What’s New?
DB2Night Show ©© 2011 Triton Consulting Ltd
pureQuery - Proposition
� JDBC has performance challenges
� SQLJ is not well understood by traditional Java developers, and not well supported by tooling
� Other solutions (Hibernate, Spring, iBatis, etc) are more
Java Application
Query Language
OR Mapping Layer
Nam
ed Q
ueries
DB2Night Show ©© 2011 Triton Consulting Ltd
Spring, iBatis, etc) are more popular with Java developers but reduce flexibility and make SQL problem diagnosis and tuning difficult
� A solution is required that combines the flexibility of Hibernate/iBatis with the efficiency of SQLJ
21
OR Mapping Layer
Persistence Layer
DB2
Nam
ed Q
ueries
pureQuery – Components
� pureQuery is part of the Optim brand, and consists of the following elements
• A set of APIs for efficient access to relational data
• Eclipse-based tooling for Java and SQL development, delivered in Optim Development Studio – chargeable option, separate components targeted at z/OS and LUW
DB2Night Show ©© 2011 Triton Consulting Ltd
separate components targeted at z/OS and LUW
• pureQuery runtime – chargeable option, separate components targeted at z/OS and LUW
22
pureQuery - APIs
� Intended to boost productivity and use best practices for RDBMS access
� Aimed at new applications – API calls embedded directly in Java code• An alternative API to JDBC and SQLJ, although the same low-level
access functions are used
� Uses SQL directly in API calls – no alternative query language Choice of static SQL or dynamic SQL variants
DB2Night Show ©© 2011 Triton Consulting Ltd
� Choice of static SQL or dynamic SQL variants� Supports several API styles to fit well into all of the popular Java
programming models/frameworks• Inline style (familiar JDBC and SQLJ approach)• Method style (similar to JDBC 4 ease of use enhancements)• Named query style (similar to iBatis / Hibernate)
� Supported by Optim Development Studio
23
pureQuery – Development Tools
� Optim Development Studio (ODS)• Previously known as IBM Data Studio
Developer• Eclipse based• Supports DB2, IDS and Oracle
development• Integrates with other IBM tools (RAD,
InfoSphere Data Architect, etc.)•
DB2Night Show ©© 2011 Triton Consulting Ltd
InfoSphere Data Architect, etc.)• Generate pureQuery access code direct
from database objects• SQL assist• Front-end for pureQuery monitoring and
runtime components• Dynamic SQL substitution to replace
poor SQL• Approx $850 per seat
24
pureQuery – Runtime
� Allows dynamic SQL (e.g JDBC calls) to be intercepted and replaced with static SQL at runtime• Process known as “client optimisation”
� Major Features• Allows dynamic SQL to be executed statically, with associated
performance/security advantages• No code changes needed
DB2Night Show ©© 2011 Triton Consulting Ltd
• No code changes needed• Works for both Java and .Net applications• Can handle parameter markers in SQL• Targeted against DB2, Informix and Oracle back-end
databases
� Internal IBM testing shows up to 40% CPU savings for T2 applications, and 15-25% for T4 – your mileage may vary!
25
pureQuery – Runtime
DB2Night Show ©© 2011 Triton Consulting Ltd
26
Source: IBM White Paper, IBM Optim pureQuery Runtime for z/OS Performance
Running IRWW workload
DB2 9 for z/OS
� GA in early 2007
� Many new features of interest from a Java/Websphere perspective• Native XML support for Java applications
• Optimistic locking
DB2Night Show ©© 2009 Triton Consulting Ltd
27
• Optimistic locking
• Network trusted contexts
• BIGINT, VARBINARY and BINARY data types
Network Trusted Contexts
DB2Night Show ©© 2009 Triton Consulting Ltd
28
DB2 10 for z/OS
� New release of DB2 for z/OS went GA in October 2010
� Many more new features of interest from a Java / Websphere perspective• High performance DBATs • Limited Block Fetch support for Type 2
DB2Night Show ©© 2011 Triton Consulting Ltd
29
• Limited Block Fetch support for Type 2 connections
• XML enhancements• TIMESTAMP precision can now match Java (6
digits of fractional seconds)• New security/audit capabilities can allow custom
code to be removed, improving performance
DB2 10 for z/OS
� More DB2 10 features• WLM_SET_CLIENT_INFO stored procedure (also
available for V9 via APAR)
• Dynamic statement cache enhancement to be more tolerant of differing literal values� Change JCC Driver to include the
DB2Night Show ©© 2011 Triton Consulting Ltd
30
� Change JCC Driver to include the “enableliteralReplacement=‘YES’” keyword
� Specified in the data source or connection property
• Possibility for significant MAXKEEPD increase due to DBM1 VSCR
• Future DB2 10 APAR expected to deliver Plan Stability support for dynamic SQL
DB2 10 – High Performance DBATs
� DB2 10 honours use of RELEASE(DEALLOCATE) for distributed applications• Ignored for DB2 9 and earlier versions
• Can provide significant CPU savings (some beta customers saw 10-20%)
• Higher EDM pool usage and potential concurrency issues
DB2Night Show ©© 2011 Triton Consulting Ltd
• Higher EDM pool usage and potential concurrency issues with DDL and BIND
� Needs JCC packages to be rebound with RELEASE(DEALLOCATE) KEEPDYNAMIC(NO)• Consider using different collection for high performance
DBATs, as you probably won’t be able to afford to run all connections that way
• Remember, focus is now on REAL not VIRTUAL storage monitoring!
31
Questions?
DB2Night Show ©© 2011 Triton Consulting Ltd
32
Triton ConsultingThe Royal
25 Bank PlainNorwich NR2 4SFUnited Kingdom
DB2Night Show ©© 2011 Triton Consulting Ltd
33
United Kingdom
email:[email protected]://www.triton.co.uk
Tel: +44 (0) 870 2411550Fax: +44 (0) 870 2411549