Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
0<br />Web 2.0 Development with DB2 <br />Dr. Vladimir Bacvanski, Vice President, InferData,  vladimir@inferdata.com<br />...
Outline<br />Challenges of Enterprise Web 2.0 Systems<br />Some Side-Effects of O/R Mapping<br />Data-Driven Applications ...
2<br />Show of Hands!<br />How many are developers, managers,involved with databases, others?<br />Are you using Java, Rub...
COMMUNITYParticipation<br />RICHUser Interfaces<br />Software as aSERVICE<br />Web 2.0<br /> DATA <br />
What matters most to Enterprise Web 2.0 Systems?<br />MVC architecture?<br />Java vs. Python vs. [insert your favorite lan...
Java Data Access – Two Views of the World<br />Writing Java code is so easy with this eclipse environment.I wish it was th...
Meet in the<br />Middle<br />Data Mapping Approaches<br />Application-Centric<br />Top-Down<br />Start with Object Domain ...
EJB and Hibernate Side Effects<br /><ul><li>DBA and SQL developer Amnesia
Where is the SQL coming from?
What is it?
Where is it?
How do we tune it?
How de we manage it?
Performance Concerns:
Some App Server vendors claim (unsurprisingly) that Managed objects performs fine.
There are many user claims of bad Managed object performance is bad on the web.
As always, the truth is in the middle.
And will depend on your app server, application, database, etc ..</li></ul>“Our top story: Large Customer moves from COBOL...
A high-performance, data access platform to simplify developing, managing, securing, and optimizing data access.<br />Intr...
Design Phase pureQuery close-up<br />Model Integration<br /><ul><li>Generate Object Model and code from Data Model</li></u...
Setup basic DAO Pattern</li></ul>Existing JDBC to Static<br /><ul><li>Reroute Dynamic Queries to Static</li></ul>Code Deve...
Database aware, Java SQL Editor</li></ul>SQL Replacement<br /><ul><li>Replace Query w/o changing source</li></ul>SQL Perfo...
Track back to SQL and line of code in the application</li></ul>Static SQL<br /><ul><li>Lock in Access plans, Improve Secur...
Code Example: pureQuery<br />11<br />Employee myEmp= db.queryFirst(     &quot;SELECT NAME, ADDRESS, PHONE_NUM FROM EMP    ...
Design<br />Develop<br />Optimize<br />Govern<br />Models<br />Policies<br />Metadata<br />Deploy<br />Operate<br />IBM Op...
Why should DBAs care ?<br />DBAs have little to no visibility of application SQL before deployment, no opportunity for rev...
Why should Developers care ?<br />Get data access right the first time !<br />Get it done faster - Improved productivity<b...
How well does it work? – Java applications<br />In-house testing shows significant performance improvements<br />IRWW – an...
How well does it work? - .Net applications<br />Throughput during static execution increased by 159% over dynamic SQL exec...
Application accesses DB2 for z/OS</li></ul>*Any performance data contained in this document were determined in various con...
17<br />Control performance<br />Decide at deployment time how the SQL is executed<br />Understand and lock down the acces...
18<br />How do I start with pureQuery<br />Existing applications<br />Optimize existing JDBC (and .NET!) applications<br /...
19<br />pureQuery Gives You Options<br />V2.1 Feature<br />Data Web Services, Project Zero, sMash<br />.Net applications<b...
20<br />pureQuery Facilitates Best Practices<br />Supports both inline SQL and Java annotations (method) <br />Intuitive i...
21<br />Optimize Existing JDBC Applications<br />Improve performance for DB2 – without changing a line of code<br />Captur...
Business Analyst<br />RequirementsAnalyst<br />Data Architect<br />Data Access Developer<br />Database Administrator<br />...
Add basic OR mapping and annotated-method style<br />pureQuery<br />pureQuery Balances Productivity and Control<br />Manag...
RAD / Development Studio Data Centric Development Scenario<br />Write in JavaUsing RAD+WAS FP for Web 2.0<br />Write in Ja...
RAD and Web 2.0 Rich Internet Applications <br />RAD supports development of Ajax applications<br />Essentially: HTML + Ja...
Upcoming SlideShare
Loading in …5
×

Web 2.0 Development with IBM DB2

3,215 views

Published on

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.

Published in: Technology
  • Be the first to comment

Web 2.0 Development with IBM DB2

  1. 1. 0<br />Web 2.0 Development with DB2 <br />Dr. Vladimir Bacvanski, Vice President, InferData, vladimir@inferdata.com<br />Rafael Coss, Solutions Architect, IBM, rcoss@ibm.com<br />Session Number 2166<br />
  2. 2. Outline<br />Challenges of Enterprise Web 2.0 Systems<br />Some Side-Effects of O/R Mapping<br />Data-Driven Applications and pureQuery<br />Rich Internet Applications: Ajax and Dojo with RAD<br />pureQuery + JEE Applications with RAD<br />pureQuery + Situational Applications with WebSphere sMash<br />IBM Optim Development Studio<br />Integrating pureQuery and WebSphere sMash with RAD<br />
  3. 3. 2<br />Show of Hands!<br />How many are developers, managers,involved with databases, others?<br />Are you using Java, Ruby, Python, Groovy, PHP,?<br />How many are using EJB, plain JDBC, Hibernate?<br />What’s most important?<br />Productivity<br />Reuse<br />Availability<br />Performance<br />Shared Database<br />Flexibility<br />
  4. 4. COMMUNITYParticipation<br />RICHUser Interfaces<br />Software as aSERVICE<br />Web 2.0<br /> DATA <br />
  5. 5. What matters most to Enterprise Web 2.0 Systems?<br />MVC architecture?<br />Java vs. Python vs. [insert your favorite language]?<br />Ajax vs. Flash?<br />MASSIVE<br />AMOUNTS<br />OF DATA<br />
  6. 6. Java Data Access – Two Views of the World<br />Writing Java code is so easy with this eclipse environment.I wish it was that easy to get the SQL right.<br />JSP<br />QoS goals<br />Spring<br />Another runaway query! Where are these coming from? JDBC? Hmmm…<br />Runstats<br />XML<br />http<br />Partition strategy<br />Stored<br />Procedures<br />mashup<br />SQL<br />Response Time!<br />REORG<br />JSON<br />JDBC<br />This ORM doesn’t allow me to leverage all my database’s SQL.<br />Inconsistent response time? How long will it take me to find the offending application sending bad SQL this time? <br />JDBC<br />I can’t believe I got called out last week. I wish I could see how these queries will run in production.<br />SQLJ<br />JPA<br />These ad-hoc queries are dangerous. We need a library of tested SQL interfaces. <br />Application<br />Developer<br />Database Developer& Administrator<br />Spring<br />Why does this query take so long?<br />iBatis, . . .<br />Sometimes I need POJOs, sometime JSON, sometimes XML, what should I use?<br />Static SQL? Sounds like another delay to getting my program deployed<br />Another GRANT request? This security administration is out of control.<br />Can I examine the SQL “before” the application is deployed?<br />
  7. 7. Meet in the<br />Middle<br />Data Mapping Approaches<br />Application-Centric<br />Top-Down<br />Start with Object Domain Model<br />ORM Mapping<br />Well supported in dynamic languages and frameworks<br />Hybrid<br />Meet in the middle<br />Can be challenging w/o comprising<br />Data-Centric<br />Bottom-UP<br />Start with Relational Data Model<br />Not well supported in dynamic languages and frameworks<br />Top<br />Down<br />Persistence Layer<br />Bottom<br />Up<br />6<br />
  8. 8. EJB and Hibernate Side Effects<br /><ul><li>DBA and SQL developer Amnesia
  9. 9. Where is the SQL coming from?
  10. 10. What is it?
  11. 11. Where is it?
  12. 12. How do we tune it?
  13. 13. How de we manage it?
  14. 14. Performance Concerns:
  15. 15. Some App Server vendors claim (unsurprisingly) that Managed objects performs fine.
  16. 16. There are many user claims of bad Managed object performance is bad on the web.
  17. 17. As always, the truth is in the middle.
  18. 18. And will depend on your app server, application, database, etc ..</li></ul>“Our top story: Large Customer moves from COBOL to Java to become more agile. In other news, DBA develop amnesia.”<br />7<br />7<br />
  19. 19. A high-performance, data access platform to simplify developing, managing, securing, and optimizing data access.<br />Introducing pureQuery<br />pureQuery Components:<br />Simple and intuitive API<br />Enables SQL access to databases or in-memory Java objects<br />Facilitates best practices <br />Optim Development Studio (integrates with RAD)<br />Integrated development environment with Java and SQL support <br />Improve problem isolation and impact analysis<br />Optim pureQuery Runtime<br />Flexible static SQL deployment for DB2<br />
  20. 20. Design Phase pureQuery close-up<br />Model Integration<br /><ul><li>Generate Object Model and code from Data Model</li></ul>V2.2<br />Jump Start Application Design<br /><ul><li>Generate SQL and Code from Database Objects
  21. 21. Setup basic DAO Pattern</li></ul>Existing JDBC to Static<br /><ul><li>Reroute Dynamic Queries to Static</li></ul>Code Development Productivity<br /><ul><li>Code Generation, Content Assist
  22. 22. Database aware, Java SQL Editor</li></ul>SQL Replacement<br /><ul><li>Replace Query w/o changing source</li></ul>SQL Performance Metrics<br /><ul><li>Find and sort query elapsed time from Java</li></ul>Java to SQL Integration<br /><ul><li>Categorize by Java, SQL, Database , Packages, track back to line of code</li></ul>Problem Determination<br /><ul><li>Monitor WebSphere Connection Pool, JDBC Driver, Network
  23. 23. Track back to SQL and line of code in the application</li></ul>Static SQL<br /><ul><li>Lock in Access plans, Improve Security, Consistent Performance</li></ul>SQL Injection Prevention<br /><ul><li>Lock down SQL for Dynamic</li></li></ul><li>Code Example: JDBC<br />java.sql.PreparedStatementps = con.prepareStatement(<br /> &quot;SELECT NAME, ADDRESS,PHONE_NUM FROM EMP <br /> WHERE NAME=?&quot;);<br />ps.setString(1, name);<br />java.sql.ResultSetrs= ps.executeQuery();<br />names.next();<br />Employee myEmp = new Employee();<br />myEmp.setName(rs.getString(1));<br />myEmp.setHomeAddress(rs.getString(2));<br />myEmp.setHomePhone(rs.getString(3));<br />names.close();<br />class Employee {<br /> String name;<br />String homeAddress;<br />String homePhone;<br /> …<br />}<br />
  24. 24. Code Example: pureQuery<br />11<br />Employee myEmp= db.queryFirst( &quot;SELECT NAME, ADDRESS, PHONE_NUM FROM EMP WHERE NAME=?&quot;, Employee.class, name);<br />Even simpler, if we have a method getEmployee with a Java annotation or XML file with SQL for the query:<br />Employee myEmp= getEmployee(name);<br />
  25. 25. Design<br />Develop<br />Optimize<br />Govern<br />Models<br />Policies<br />Metadata<br />Deploy<br />Operate<br />IBM Optim pureQuery<br />Reduce costs<br />Increase system throughput <br />Improve developer productivity<br />Move workload to zIIP and zAAP<br />Improve quality of service for new and existing Java applications <br />Improve performance <br />Lock in access plans<br />Speed up problem resolution<br />Reduce development time for new Java applications<br />Bridge Java and data<br />Balance productivity and control<br />Enhance developer and DBA collaboration<br />Enhance security<br />Limit user access <br />Minimize SQL injection risk<br />Improve audit readiness<br />Developer<br />Develop<br />Code<br />Debug<br />Test<br />Tune, Package<br />Tester<br />
  26. 26. Why should DBAs care ?<br />DBAs have little to no visibility of application SQL before deployment, no opportunity for review and optimization <br />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<br />Constantly increasing Java application workload taxes existing systems – need to fit more work into existing systems<br />SQL injection represents an increasing risk to data security<br />
  27. 27. Why should Developers care ?<br />Get data access right the first time !<br />Get it done faster - Improved productivity<br />Single environment that spans Java application and database development<br />Improved problem isolation and resolution<br />
  28. 28. How well does it work? – Java applications<br />In-house testing shows significant performance improvements<br />IRWW – an OLTP workload, Type 4 driver<br />Cache hit ratio between 70 and 85%<br />23 % improvement in throughput using pureQuery over dynamic JDBC<br />15% - 25% reduction on CPU per transaction over dynamic JDBC <br />15<br />
  29. 29. How well does it work? - .Net applications<br />Throughput during static execution increased by 159% over dynamic SQL execution assuming a 79% statement cache hit ratio <br /><ul><li>IRWW – OLTP application
  30. 30. Application accesses DB2 for z/OS</li></ul>*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.<br />16<br />
  31. 31. 17<br />Control performance<br />Decide at deployment time how the SQL is executed<br />Understand and lock down the access plan for SQL<br />Replace suboptimal SQL without changing the application<br />Control security<br />Prevent SQL injection<br />Prevent execution of unauthorized SQL<br />Better manage database security <br />See inside applications that are driving your database<br />Understand where SQL comes from<br />Understand when frameworks and ORM’s are getting in the way<br />Simplify problem determination and troubleshooting<br />Correlate problem SQL with applications, ORM’s and frameworks<br />Optim pureQuery Runtime<br />
  32. 32. 18<br />How do I start with pureQuery<br />Existing applications<br />Optimize existing JDBC (and .NET!) applications<br />No code changes needed<br />Have to go through the client optimization process to get to static SQL<br />New applications<br />Use the pureQuery API<br />Development codes using one API regardless of whether it is deployed dynamically or statically<br />DBA deploys statically<br />No need to go through client optimization process<br />Other<br />JPA, iBatis, Hibernate<br />
  33. 33. 19<br />pureQuery Gives You Options<br />V2.1 Feature<br />Data Web Services, Project Zero, sMash<br />.Net applications<br />Hibernate, iBATIS, EclipseLink,...<br />JPA for WebSphere, Apache OpenJPA <br />Optim pureQuery<br />Plain JDBC<br />JPA API<br />Web API<br />Open Source Persistence API<br />.Net Applications<br />pureQuery API<br />JDBC API<br />JPA Persistence Engine<br />Open Source Persistence Engine<br />JDBC<br /> pureQuery<br />ADO .Net<br /> JCC driver<br />DB2 and Informix now<br />More coming<br />
  34. 34. 20<br />pureQuery Facilitates Best Practices<br />Supports both inline SQL and Java annotations (method) <br />Intuitive interfaces for common data retrieval and manipulation scenarios hides JDBC complexity<br />Query First<br />Homogeneous Batch<br />Reduce network trips to the database <br />Query Over Java Collections<br />Heterogeneous Batch<br />Use custom result handlers to map results to POJO’s, XML, JSON, …<br />Write high performance Java data access applications, Part 3: <br />Data Studio pureQuery API best practices<br />-- VitorRodrigues<br />http://www.ibm.com/developerworks/db2/library/techarticle/dm-808rodrigues/?S_TACT=105AGX01&S_CMP=LP<br />
  35. 35. 21<br />Optimize Existing JDBC Applications<br />Improve performance for DB2 – without changing a line of code<br />Capture Configure Bind Execute<br />pureQuery client optimization enables static execution for JDBC applications (custom-developed, framework-based, or packaged)<br />Existing JDBC Application<br />Captured SQL- <br />related<br />metadata<br />JDBC Driver w/ pureQuery<br />Dynamic SQL execution <br />Static SQL execution <br />DB2 Data Servers<br />&quot;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.&quot; <br />— David Beulke, Pragmatic Solutions Inc.<br />
  36. 36. Business Analyst<br />RequirementsAnalyst<br />Data Architect<br />Data Access Developer<br />Database Administrator<br />Software Architect<br />Developer<br />Integration with Rational<br />Creates businessprocess model<br />WebSphereBusiness Modeler<br />Transform between business items and data model<br />Create & manage software delivery requirements<br />Link requirements to data assets<br />RationalRequisitePro<br />Create architectural model enablingthe tasks from BPM to be <br />automated<br />RationalSoftware Modeler 7.5<br />Transform between software and data models<br />Create or reverse engineer logical and physical models<br />Transform Models to Code<br />RationalSoftware Architect 7.5<br />Infosphere<br />Data Architect 7.5<br />Implement new& integrate existing services<br />Implement newprocedures and services<br />RationalApplication Developer7. 5<br />Optim Development Studio<br />Extract test data from production systems<br />Rational <br />ClearQuest<br />Optim Test Data Manager<br />
  37. 37. Add basic OR mapping and annotated-method style<br />pureQuery<br />pureQuery Balances Productivity and Control<br />Managed objects <br />Object-relational mapping<br />Full SQL control<br />Code all your SQL<br />JDBC / SQLJ<br />Use SQL templates, inline only<br />Spring <br />templates<br />iBATIS<br />Complex OR mapping and persistence management, but loss of controls<br />Hibernate<br />Adds container management option<br />OpenJPA <br />(EJB3)<br />
  38. 38. RAD / Development Studio Data Centric Development Scenario<br />Write in JavaUsing RAD+WAS FP for Web 2.0<br />Write in Java with pureQueryUsing Optim Dev. Studio in RAD<br />Access generated Java data objects from code developed in RAD<br />WAS Feature Pack for Web 2.0<br />
  39. 39. RAD and Web 2.0 Rich Internet Applications <br />RAD supports development of Ajax applications<br />Essentially: HTML + JavaScript + Asynchronous communication<br />Uses Dojo Ajax libraries<br />IBM Dojo extensions<br />Visual tools for Dojo UI development<br />Libraries and tools:<br />Invoking Java code from Dojo with RPC Adapter<br />JSON4J<br />Ajax messaging<br />25<br />
  40. 40. Choosing the Right Tools<br />Strategic, IT built applications.<br />WebSphere sMash<br />Responding to unplanned situations.<br />Innovating around prospective business opportunities where agility is key and the outcome is still unknown.<br />Enabling new insights by combining information from the web and enterprise data sources.<br />RAD + WASHeavily used, complex applications built by IT teams.<br />Usage<br />Simple applications built by professionals<br />
  41. 41. What is WebSphere sMash?<br />Groovy and PHP<br />Uses pureQuery for data access<br />Can use Java code<br />Convention over configuration<br /> Common tasks do not require configuration<br />Application-centric runtime<br /> Write the app, run it, and it’s ready for use<br /> No need for a separate application server<br />Each app has its own JVM process<br />Fast start!<br />27<br />A complete platform for developing, assembling<br />and executing agile Web 2.0 apps quickly and simply.<br />
  42. 42. RAD, WebSphere sMash and pureQuery in Data Centric Development<br />Development scenario:<br />A database already exist<br />We want to use the productive Optim Development Studio development features<br />We want to benefit from pureQuery features<br />We may need to integrate with other already existing components and applications<br />Solution:<br />Use WebSphere sMash together with RAD + Development Studio<br />Shell share<br />Generate Java code from Development Studio functionality, use from Groovy<br />Use RAD powerful features for GUI Dojo development and integration with other components and applications<br />
  43. 43. Development and Execution: pureQuery and sMash<br />Develop mostly w. Optim Dev. Studio + sMash<br />Develop mostly with RAD<br />RIA UI with Dojo<br />Design<br />DB<br />JEE/J2EEComponents<br />Existing Applications<br />Execution<br />
  44. 44. Start with the Database<br />Use Development Studio to explore the database<br /><ul><li>Then generate the pureQuery code
  45. 45. This will create the Java classes in the sMash project</li></li></ul><li>Using pureQuery Code in WebSphere sMash<br />Using Development Studio, pureQuery code is generated in Java folders<br />pureQuery code is used from Groovy or PHP<br />
  46. 46. Using Java pureQuery Code from Groovy<br /><ul><li>Access the database using the pureQuery generated helper class
  47. 47. Invoke generated method to list the employees
  48. 48. Convert the result to JSON and send it to the client
  49. 49. Clients consume the result as e.g. RIA: AJAX, Flex, …
  50. 50. sMash function handles GET HTTP requests</li></li></ul><li>33<br />
  51. 51. Conclusion<br />
  52. 52. Demo<br />35<br />Demo!<br />
  53. 53. Next Steps – Learn and Explore!<br /><ul><li>Optim Development Studio and pureQuery
  54. 54. http://ibm.com/software/data/optim/development-studio/
  55. 55. WebShpere sMash
  56. 56. http://ibm.com/software/webservers/smash/
  57. 57. Rational Application Developer
  58. 58. http://ibm.com/software/awdtools/developer/application/</li></li></ul><li>Where to go Next? Resources and more…<br />WebSphere sMash<br />http://www.ibm.com/websphere/smash<br />Optim Development Studio <br />http://www.ibm.com/software/data/optim/development-studio/<br />IBM pureQuery<br />http://www.ibm.com/software/data/optim/purequery-platform/faq.html<br />pureQuery Custom Training <br />InferData, IBM Business Partner http://www.inferdata.com<br />Course: Developing Database Applications with Optim Development Studio and pureQuery<br />http://www.inferdata.com/training/data/optim_purequery_training.html<br />37<br />
  59. 59. Web, Blogs<br />Project Zero<br />http://www.projectzero.org<br />Integrated Data Management (Optim and Data Studio)<br />http://www.ibm.com/developerworks/spaces/optim<br />Blogs: <br />On Building Software http://www.OnBuildingSoftware.com<br />Data Life Cycle ++ http://datalifecycle.blogspot.com<br />Twitter:<br />http://twitter.com/OnSoftware<br />http://twitter.com/racoss<br />38<br />
  60. 60. 39<br />Thank You!Your Feedback is Important to Us<br />Please complete the survey for this session by:<br />Accessing the SmartSite on your smart phone or computer at: iodsmartsite.com <br />Surveys / My Session Evaluations<br />Visiting any onsite event kiosk<br />Surveys / My Session Evaluations<br />Each completed survey increases your chance to win an Apple iPod Touch with daily drawling sponsored by Alliance Tech<br />39<br />

×