AD 112: Real World Experience: Integrating DB2 with XPages Steve Zavocki Navy Federal Credit Union Consultant Dwain Wuerfel Navy Federal Credit Union.

Download AD 112: Real World Experience: Integrating DB2 with XPages Steve Zavocki Navy Federal Credit Union Consultant Dwain Wuerfel Navy Federal Credit Union.

Post on 14-Jan-2016

216 views

Category:

Documents

3 download

Embed Size (px)

TRANSCRIPT

<p>Real World Experience: Integrating DB2 with XPages</p> <p>AD 112: Real World Experience: Integrating DB2 with XPages</p> <p>Steve Zavocki Navy Federal Credit Union ConsultantDwain Wuerfel Navy Federal Credit UnionMWLUG 20141Real World Experience: Integrating DB2 with XPagesAbout Steve </p> <p>Notes Developer since 1996Exclusively XPages since 2012Fluent in Java, and use it whenever possibleHave been a consultant with Navy Federal since April 2014 working out of Milton, Florida</p> <p>Real World Experience: Integrating DB2 with XPagesAbout DwainNotes Developer since 1997XPages since 2011Have been an employee with Navy Federal since July 2014 working out of Milton, Florida</p> <p>Real World Experience: Integrating DB2 with XPagesAbout Navy Federal Credit UnionThe worlds largest credit union$69 billion in assets and over 5.5 million membersApproximately 12,000 employees worldwideMember-owned and not-for-profit We offer credit cards, auto loans, mortgages, checking and savings, CDs, IRAs and our subsidiary Navy Federal Financial Group offers investments &amp; insuranceNavy Federal: Field of MembershipWe serve all Department of Defense and Coast Guard active duty, civilian and contractor personnel and their familiesWe have 270 branches worldwide; online, mobile account access, and call center 24/7FORTUNE's 100 Best Companies to Work For in 2015Fifth time selectedComputerWorlds 2015 Best Place to Work in IT</p> <p>Real World Experience: Integrating DB2 with XPagesAgenda</p> <p>Why use DB2?Application OverviewApplication DesignDB2 configurationLessons LearnedWhat your DBA wants you to knowReal World Experience: Integrating DB2 with XPagesWhy Use DB2?</p> <p>Real World Experience: Integrating DB2 with XPagesWhy Use DB2?</p> <p>PerformanceWhy is this important to NFCU?References7Real World Experience: Integrating DB2 with XPagesWhy Use DB2? </p> <p>PerformanceDB2 z/OS, DB2 LUW, Oracle, SQL Server, Teradata, and NotesNavy Federal uses all these, but chose DB2 for XPages back-endTimestamp data type to the one millionth placeBoth Notes and Java only use one thousandthNotes/Java: 07:50:25.123000DB2: 07:50:25.123456</p> <p>8Real World Experience: Integrating DB2 with XPagesWhy Use DB2? </p> <p>Performance contd10 or 10,000,000 rows irrelevant Dont try this using a Notes databasePhysical storage is allocated for future growthThis means you never encounter an out of space conditionMoves large quantities of data and manages high volume of transactionPotential for large volumes of transactionsDB2 has data sharing which is similar to replication/clusteringKnow that this exists, DBA should already be using this9Real World Experience: Integrating DB2 with XPagesWhy Use DB2? </p> <p>Why is this important to Navy FCU you askNavy FCU measures success as No Perceived DowntimeXPages uses DB2 as a back-end due to the existing transactional member/customer facing applicationsAuditingSecurity Concerns10Real World Experience: Integrating DB2 with XPagesWhy Use DB2?</p> <p>Comparison with Oraclehttp://www-01.ibm.com/software/info/rte/breakfree/tw.htmlMore information about the benefits of DB2http://www-01.ibm.com/software/data/db2/zos/family/11Real World Experience: Integrating DB2 with XPagesApplication Overview</p> <p>Real World Experience: Integrating DB2 with XPagesApplication Overview</p> <p>In a nutshell, the application manages ATM by providing a web browser front- end to a mainframe applicationThis application replaces having a person use the green screen, and it eliminates tedious data entry into an MS Access databaseAll actions that take place whether user initiated or scheduled are recorded in DBThe data is then used for reporting and searching</p> <p>Real World Experience: Integrating DB2 with XPages</p> <p>Real World Experience: Integrating DB2 with XPagesApplication Overview</p> <p>Real World Experience: Integrating DB2 with XPagesApplication Design</p> <p>Real World Experience: Integrating DB2 with XPagesApplication Design</p> <p>Employ Best Practices learned by personal and collective experiencesMinimize SSJS. Use Java for business logic whenever feasibleTry to follow the MVC design patternConsidered using object relational mapping (i.e. Hibernate)Considered other developers who later will work on the application</p> <p>Real World Experience: Integrating DB2 with XPagesApplication Design View Layer UIXPagesCustom Controls</p> <p>Controller Layer Business Logic</p> <p>Managed BeansPOJOsJars (server JVM/LIB/EXT folder) Model Layer Data</p> <p>DB2 running on mainframevia SQLvia ???Real World Experience: Integrating DB2 with XPagesApplication Design</p> <p>How is the DB2 tied to the UI elements?</p> <p>viewScope is the glue that ties it all together. </p> <p>IMO it is easier to code than managed bean members/fieldsLoad it when you need it, no values are remembered when you leave the pageAll purpose Binds UI fields or grid dataNo need to initialize numeric data type, everything is treated like a String in a scoped variable</p> <p>Real World Experience: Integrating DB2 with XPagesDemoGo to the blog by Steve Zavocki athttp://notesspeak.blogspot.com/Real World Experience: Integrating DB2 with XPagesDB2 Configuration</p> <p>Real World Experience: Integrating DB2 with XPagesDB2 Configuration</p> <p>Device DriversExtension Libraryjava.policyWinSQLCustom Connection Manager</p> <p>Real World Experience: Integrating DB2 with XPagesDB2 Configuration</p> <p>Device DriversIt depends on your DB2 version which drivers you use. Your DBA or Middleware team will provide these for youWe installed on the server in the jvm/lib/ext location. The choice was not ours to make (IBM does not recommend this approach but instead recommends installing as OSGI plugin)You do not need to install DB2 drivers locally, unless you are writing Java or LS agents that will access DB2, and you want to test them locally. If you do then they need to be in your local jvm/lib/extReal World Experience: Integrating DB2 with XPagesDB2 Configuration</p> <p>Extension LibraryThe XPages Extension Library is of course requiredThe version that is bundled with 9.0 is not enoughWe couldnt get the database connection to work using a 9.0.1 at all until we installed at least the Dec 19, 2014 version from OpenNTFReal World Experience: Integrating DB2 with XPagesDB2 Configuration</p> <p>java.policyYou should be aware that this file exists on your domino serverThis file is used to control security permissions for specific actions and locationsIf you put your jars in the jvm/lib/ext directory then you will want to make sure your java.policy file grants full access:grant codeBase "file:${java.home}/lib/ext/*" { permission java.security.AllPermission;};</p> <p>Real World Experience: Integrating DB2 with XPagesDB2 Configuration</p> <p>WinSQL You will certainly need a tool for easily testing your SQL. Our company has standardized on WinSQL for this task.This product is offered by Synametrics and info can be found at: http://web.synametrics.com/WinSQL.htmCost is $99 for a developer licenseComparable to Toad, SQL Developer (Oracle)</p> <p>Real World Experience: Integrating DB2 with XPagesDB2 Configuration WinSQL</p> <p>Real World Experience: Integrating DB2 with XPagesDB2 Configuration</p> <p>Custom Connection ManagerNFCU has a policy that usernames and passwords are not to be kept in XML filesWe created a custom ConnectionManager class that allows us to look to a secure database for credentials and still allow the use of Connection PoolingMore information on how to do this can be found on Steves blog at http://notesspeak.blogspot.com/</p> <p>Real World Experience: Integrating DB2 with XPagesLessons Learned</p> <p>Real World Experience: Integrating DB2 with XPagesLessons Learned</p> <p>Know what you need from your DBATake the time ahead of time to understand your application requirementBe sure that column widths and types are correct before codingMimic what Notes databases give you by default by having system columns for Created Date, Last Updated, Author, Last Updated ByDo not let DBA arbitrarily specify columns to be se to NOT NULLAsk your DBA to consider using a stored procedure or trigger to update intermediate tables for that are needed for many-to-many data relationships</p> <p>30Real World Experience: Integrating DB2 with XPagesLessons Learned</p> <p>Know what you need from your DBAAsk your DBA to consider using a stored procedure or trigger to update intermediate tables for that are needed for many-to-many data relationships</p> <p>31Real World Experience: Integrating DB2 with XPagesLessons Learned</p> <p>Use the PreparedStatement classThe PreparedStatement is a class in the java.sql package that makes it easy to generate SQL statementsThis class protects against SQL Injection, use of this coding class is a company standardThis class protects against bad data causing errors32Real World Experience: Integrating DB2 with XPagesLessons Learned</p> <p> Yes this really happened</p> <p>String userCity = D'Iberville);int userTaxDue = 0;Date userTaxDue = taxDueDate; String userID = 12345;</p> <p>String sqlUpdate = "UPDATEUSER_DETAIL SET USER_CITY = + userCity + , USER_TAX_DUE_AMT = + userTaxDue + , USER_TAX_DUE_DT = + userTaxDue + WHERE USER_ID = + userID;</p> <p>33Real World Experience: Integrating DB2 with XPagesLessons Learned</p> <p> Using the PreparedStatement class</p> <p>String sqlUpdate = "UPDATEUSER_DETAIL SET USER_CITY = ?, USER_TAX_DUE_AMT = ?, USER_TAX_DUE_DT = ?WHERE USER_ID = ?";PreparedStatement ps = null;ps = conn.prepareStatement(sqlUpdate);ps.setString(1, D'Iberville);ps.setInt(2, 0);ps.setDate(3, new Date());ps.setString(4, 12345);ps.executeUpdate();</p> <p>34Real World Experience: Integrating DB2 with XPagesThis is the code from theme that was set to load on every page.</p> <p>application/x-javascriptjs/jquery.datepick.min.js</p> <p>application/x-javascriptjs/jquery.datepick.validation.js</p> <p>Lessons Learned</p> <p>Bonus Lesson(if time allows, game time decision)This doesnt have anything to do with DB2, but one major issues we had was sporadic 403 errors when we deployed from our UNIT to INTG environment.The issue turned out to be resources that the server was trying to load on the anonymous login page. 35Real World Experience: Integrating DB2 with XPagesLessons Learned</p> <p>Resolution to the evil 403 problem (thanks @edm00se)</p> <p>Fix was to change the theme to skip loading the resources on the login page</p> <p>application/x-javascriptjs/jquery.datepick.min.js</p>

Recommended

View more >