Vladimir Bacvanski and Rafael Coss
Common demands for Web 2.0 application are rich interactivity and ability to handle large volumes of data. Join us to see
how to integrate IBM DB2, IBM WebSphere sMash and high-performance data access through IBM Optim pureQuery. This
combination provides a way to rapidly develop data-centric, scalable dynamic Web applications. See how we begin with a DB2
database, access the data with Optim pureQuery, use business objects in Groovy, and expose them to users through Dojo AJAX framework.
Unlocking the Potential of the Cloud for IBM Power Systems
Web 2.0 Development with IBM DB2
1. 0 Web 2.0 Development with DB2 Dr. Vladimir Bacvanski, Vice President, InferData, vladimir@inferdata.com Rafael Coss, Solutions Architect, IBM, rcoss@ibm.com Session Number 2166
2. Outline Challenges of Enterprise Web 2.0 Systems Some Side-Effects of O/R Mapping Data-Driven Applications and pureQuery Rich Internet Applications: Ajax and Dojo with RAD pureQuery + JEE Applications with RAD pureQuery + Situational Applications with WebSphere sMash IBM Optim Development Studio Integrating pureQuery and WebSphere sMash with RAD
3. 2 Show of Hands! How many are developers, managers,involved with databases, others? Are you using Java, Ruby, Python, Groovy, PHP,? How many are using EJB, plain JDBC, Hibernate? What’s most important? Productivity Reuse Availability Performance Shared Database Flexibility
5. What matters most to Enterprise Web 2.0 Systems? MVC architecture? Java vs. Python vs. [insert your favorite language]? Ajax vs. Flash? MASSIVE AMOUNTS OF DATA
6. Java Data Access – Two Views of the World Writing Java code is so easy with this eclipse environment.I wish it was that easy to get the SQL right. JSP QoS goals Spring Another runaway query! Where are these coming from? JDBC? Hmmm… Runstats XML http Partition strategy Stored Procedures mashup SQL Response Time! REORG JSON JDBC This ORM doesn’t allow me to leverage all my database’s SQL. Inconsistent response time? How long will it take me to find the offending application sending bad SQL this time? JDBC I can’t believe I got called out last week. I wish I could see how these queries will run in production. SQLJ JPA These ad-hoc queries are dangerous. We need a library of tested SQL interfaces. Application Developer Database Developer& Administrator Spring Why does this query take so long? iBatis, . . . Sometimes I need POJOs, sometime JSON, sometimes XML, what should I use? Static SQL? Sounds like another delay to getting my program deployed Another GRANT request? This security administration is out of control. Can I examine the SQL “before” the application is deployed?
7. Meet in the Middle Data Mapping Approaches Application-Centric Top-Down Start with Object Domain Model ORM Mapping Well supported in dynamic languages and frameworks Hybrid Meet in the middle Can be challenging w/o comprising Data-Centric Bottom-UP Start with Relational Data Model Not well supported in dynamic languages and frameworks Top Down Persistence Layer Bottom Up 6
18. And will depend on your app server, application, database, etc ..“Our top story: Large Customer moves from COBOL to Java to become more agile. In other news, DBA develop amnesia.” 7 7
19. A high-performance, data access platform to simplify developing, managing, securing, and optimizing data access. Introducing pureQuery pureQuery Components: Simple and intuitive API Enables SQL access to databases or in-memory Java objects Facilitates best practices Optim Development Studio (integrates with RAD) Integrated development environment with Java and SQL support Improve problem isolation and impact analysis Optim pureQuery Runtime Flexible static SQL deployment for DB2
20.
21.
22.
23.
24. Code Example: pureQuery 11 Employee myEmp= db.queryFirst( "SELECT NAME, ADDRESS, PHONE_NUM FROM EMP WHERE NAME=?", Employee.class, name); Even simpler, if we have a method getEmployee with a Java annotation or XML file with SQL for the query: Employee myEmp= getEmployee(name);
25. Design Develop Optimize Govern Models Policies Metadata Deploy Operate IBM Optim pureQuery Reduce costs Increase system throughput Improve developer productivity Move workload to zIIP and zAAP Improve quality of service for new and existing Java applications Improve performance Lock in access plans Speed up problem resolution Reduce development time for new Java applications Bridge Java and data Balance productivity and control Enhance developer and DBA collaboration Enhance security Limit user access Minimize SQL injection risk Improve audit readiness Developer Develop Code Debug Test Tune, Package Tester
26. Why should DBAs care ? DBAs have little to no visibility of application SQL before deployment, no opportunity for review and optimization Problem isolation takes days with contemporary environments such as Java, PHP, .NET, etc due to inability to trace SQL to Java application and source code Constantly increasing Java application workload taxes existing systems – need to fit more work into existing systems SQL injection represents an increasing risk to data security
27. Why should Developers care ? Get data access right the first time ! Get it done faster - Improved productivity Single environment that spans Java application and database development Improved problem isolation and resolution
28. How well does it work? – Java applications In-house testing shows significant performance improvements IRWW – an OLTP workload, Type 4 driver Cache hit ratio between 70 and 85% 23 % improvement in throughput using pureQuery over dynamic JDBC 15% - 25% reduction on CPU per transaction over dynamic JDBC 15
29.
30. Application accesses DB2 for z/OS*Any performance data contained in this document were determined in various controlled laboratory environments and are for reference purposes only. Customers should not adapt these performance numbers to their own environments as system performance standards. The results that may be obtained in other operating environments may vary significantly. Users of this document should verify the applicable data for their specific environment. 16
31. 17 Control performance Decide at deployment time how the SQL is executed Understand and lock down the access plan for SQL Replace suboptimal SQL without changing the application Control security Prevent SQL injection Prevent execution of unauthorized SQL Better manage database security See inside applications that are driving your database Understand where SQL comes from Understand when frameworks and ORM’s are getting in the way Simplify problem determination and troubleshooting Correlate problem SQL with applications, ORM’s and frameworks Optim pureQuery Runtime
32. 18 How do I start with pureQuery Existing applications Optimize existing JDBC (and .NET!) applications No code changes needed Have to go through the client optimization process to get to static SQL New applications Use the pureQuery API Development codes using one API regardless of whether it is deployed dynamically or statically DBA deploys statically No need to go through client optimization process Other JPA, iBatis, Hibernate
33. 19 pureQuery Gives You Options V2.1 Feature Data Web Services, Project Zero, sMash .Net applications Hibernate, iBATIS, EclipseLink,... JPA for WebSphere, Apache OpenJPA Optim pureQuery Plain JDBC JPA API Web API Open Source Persistence API .Net Applications pureQuery API JDBC API JPA Persistence Engine Open Source Persistence Engine JDBC pureQuery ADO .Net JCC driver DB2 and Informix now More coming
34. 20 pureQuery Facilitates Best Practices Supports both inline SQL and Java annotations (method) Intuitive interfaces for common data retrieval and manipulation scenarios hides JDBC complexity Query First Homogeneous Batch Reduce network trips to the database Query Over Java Collections Heterogeneous Batch Use custom result handlers to map results to POJO’s, XML, JSON, … Write high performance Java data access applications, Part 3: Data Studio pureQuery API best practices -- VitorRodrigues http://www.ibm.com/developerworks/db2/library/techarticle/dm-808rodrigues/?S_TACT=105AGX01&S_CMP=LP
35. 21 Optimize Existing JDBC Applications Improve performance for DB2 – without changing a line of code Capture Configure Bind Execute pureQuery client optimization enables static execution for JDBC applications (custom-developed, framework-based, or packaged) Existing JDBC Application Captured SQL- related metadata JDBC Driver w/ pureQuery Dynamic SQL execution Static SQL execution DB2 Data Servers "The ability to use static SQL with pureQuery is huge. Recently, I worked with a client who could reduce CPU usage by 7 percent thanks to this one feature." — David Beulke, Pragmatic Solutions Inc.
36. Business Analyst RequirementsAnalyst Data Architect Data Access Developer Database Administrator Software Architect Developer Integration with Rational Creates businessprocess model WebSphereBusiness Modeler Transform between business items and data model Create & manage software delivery requirements Link requirements to data assets RationalRequisitePro Create architectural model enablingthe tasks from BPM to be automated RationalSoftware Modeler 7.5 Transform between software and data models Create or reverse engineer logical and physical models Transform Models to Code RationalSoftware Architect 7.5 Infosphere Data Architect 7.5 Implement new& integrate existing services Implement newprocedures and services RationalApplication Developer7. 5 Optim Development Studio Extract test data from production systems Rational ClearQuest Optim Test Data Manager
37. Add basic OR mapping and annotated-method style pureQuery pureQuery Balances Productivity and Control Managed objects Object-relational mapping Full SQL control Code all your SQL JDBC / SQLJ Use SQL templates, inline only Spring templates iBATIS Complex OR mapping and persistence management, but loss of controls Hibernate Adds container management option OpenJPA (EJB3)
38. RAD / Development Studio Data Centric Development Scenario Write in JavaUsing RAD+WAS FP for Web 2.0 Write in Java with pureQueryUsing Optim Dev. Studio in RAD Access generated Java data objects from code developed in RAD WAS Feature Pack for Web 2.0
39. RAD and Web 2.0 Rich Internet Applications RAD supports development of Ajax applications Essentially: HTML + JavaScript + Asynchronous communication Uses Dojo Ajax libraries IBM Dojo extensions Visual tools for Dojo UI development Libraries and tools: Invoking Java code from Dojo with RPC Adapter JSON4J Ajax messaging 25
40. Choosing the Right Tools Strategic, IT built applications. WebSphere sMash Responding to unplanned situations. Innovating around prospective business opportunities where agility is key and the outcome is still unknown. Enabling new insights by combining information from the web and enterprise data sources. RAD + WASHeavily used, complex applications built by IT teams. Usage Simple applications built by professionals
41. What is WebSphere sMash? Groovy and PHP Uses pureQuery for data access Can use Java code Convention over configuration Common tasks do not require configuration Application-centric runtime Write the app, run it, and it’s ready for use No need for a separate application server Each app has its own JVM process Fast start! 27 A complete platform for developing, assembling and executing agile Web 2.0 apps quickly and simply.
42. RAD, WebSphere sMash and pureQuery in Data Centric Development Development scenario: A database already exist We want to use the productive Optim Development Studio development features We want to benefit from pureQuery features We may need to integrate with other already existing components and applications Solution: Use WebSphere sMash together with RAD + Development Studio Shell share Generate Java code from Development Studio functionality, use from Groovy Use RAD powerful features for GUI Dojo development and integration with other components and applications
43. Development and Execution: pureQuery and sMash Develop mostly w. Optim Dev. Studio + sMash Develop mostly with RAD RIA UI with Dojo Design DB JEE/J2EEComponents Existing Applications Execution
59. Web, Blogs Project Zero http://www.projectzero.org Integrated Data Management (Optim and Data Studio) http://www.ibm.com/developerworks/spaces/optim Blogs: On Building Software http://www.OnBuildingSoftware.com Data Life Cycle ++ http://datalifecycle.blogspot.com Twitter: http://twitter.com/OnSoftware http://twitter.com/racoss 38
60. 39 Thank You!Your Feedback is Important to Us Please complete the survey for this session by: Accessing the SmartSite on your smart phone or computer at: iodsmartsite.com Surveys / My Session Evaluations Visiting any onsite event kiosk Surveys / My Session Evaluations Each completed survey increases your chance to win an Apple iPod Touch with daily drawling sponsored by Alliance Tech 39