EGL                         Introduction                     IBM Toronto Lab




IBM Rational Business Developer Extension...
EGL                                        Introduction                                        IBM Toronto Lab


First Edi...
EGL                          Introduction                           IBM Toronto Lab


Overall Lab Guide

                 ...
EGL                                            Introduction                                             IBM Toronto Lab


...
EGL                                            Introduction                                            IBM Toronto Lab


 ...
EGL                            Introduction                           IBM Toronto Lab



EGL for System i developers
This ...
EGL                            Introduction                           IBM Toronto Lab


   •   The second page shows a sea...
EGL                             Introduction                             IBM Toronto Lab




   •   All fields from the Sy...
EGL                           Introduction                         IBM Toronto Lab



Creating the application
First Steps...
EGL                          Introduction                        IBM Toronto Lab




   • Enter a new name, like in the fi...
EGL                           Introduction                        IBM Toronto Lab


BEFORE CREATING A PROJECT you should s...
EGL                           Introduction                         IBM Toronto Lab




   •   Expand the EGL node in the p...
EGL                             Introduction                          IBM Toronto Lab


    • Click on SQL inside the EGL ...
EGL                           Introduction                          IBM Toronto Lab



Create an EGL web project

The foll...
EGL                          Introduction                     IBM Toronto Lab




  • Select Web from the tree in the Open...
EGL                           Introduction                         IBM Toronto Lab




   •    Right click on the white sp...
EGL                            Introduction                           IBM Toronto Lab




   •   Provide a Project name – ...
EGL                          Introduction                     IBM Toronto Lab




   •   Select Default style sheet(CSS fi...
EGL                            Introduction                     IBM Toronto Lab




   •   Accept the defaults on this dia...
EGL                            Introduction                         IBM Toronto Lab




   •   Make sure the radio button ...
EGL                             Introduction                           IBM Toronto Lab




In the workbench
    • Expand y...
EGL                             Introduction                           IBM Toronto Lab




•   Select your project and rig...
EGL                            Introduction                          IBM Toronto Lab


You want to create an application t...
EGL                           Introduction                          IBM Toronto Lab




   •   Select your project EGL_lab...
EGL                          Introduction                       IBM Toronto Lab




On the New Connection dialog:
   • Exp...
EGL                           Introduction                          IBM Toronto Lab




    • Click the OK button
    • Cl...
EGL                            Introduction                          IBM Toronto Lab


For each of the tables, you will th...
EGL                             Introduction                           IBM Toronto Lab


In this application you will just...
EGL                         Introduction                     IBM Toronto Lab




For Item:
    • Select ITEM_ID as key fie...
EGL                             Introduction                          IBM Toronto Lab




 For Orders:
    • Select Order_...
EGL                            Introduction                         IBM Toronto Lab




   •   Fix up some of the headings...
EGL                      Introduction                      IBM Toronto Lab




Monday, July 19, 2010   © COPYRIGHT IBM Cor...
EGL                      Introduction                      IBM Toronto Lab




Monday, July 19, 2010   © COPYRIGHT IBM Cor...
EGL                      Introduction                      IBM Toronto Lab




Monday, July 19, 2010   © COPYRIGHT IBM Cor...
EGL                              Introduction                          IBM Toronto Lab




   •   Click the Next > button
...
EGL                           Introduction                         IBM Toronto Lab




   •   Make sure that the selected ...
EGL                            Introduction                          IBM Toronto Lab




The summary shows what has been s...
EGL                         Introduction                     IBM Toronto Lab




In case you have generation errors.
    •...
EGL                             Introduction                           IBM Toronto Lab



Specifying the runtime environme...
EGL                            Introduction                     IBM Toronto Lab




    •   Scroll down in the editor to t...
EGL                          Introduction                     IBM Toronto Lab




   • Scroll up to the top in the editor
...
EGL                            Introduction                          IBM Toronto Lab




    • Select the IBM DB2 database...
EGL                            Introduction                         IBM Toronto Lab




   • Specify a name for the provid...
EGL                           Introduction                        IBM Toronto Lab




   •  Click the Add button for the D...
EGL                            Introduction                          IBM Toronto Lab




    • Select the DB2 UDB for iSer...
EGL                          Introduction                        IBM Toronto Lab




   •    Specify the JNDI name that yo...
EGL                            Introduction                          IBM Toronto Lab




   • Specify the server name (in ...
EGL                            Introduction                         IBM Toronto Lab




   •   Scroll down to Substitution...
EGL                             Introduction                          IBM Toronto Lab


format is used when getting the da...
EGL                           Introduction                           IBM Toronto Lab




   •   Save the Deployment descri...
EGL                           Introduction                         IBM Toronto Lab




   •   Expand the EGLSource directo...
EGL                              Introduction                           IBM Toronto Lab




   •    Expand the WebContent ...
EGL                            Introduction                          IBM Toronto Lab




     • Select WebSphere Applicati...
EGL                              Introduction                            IBM Toronto Lab




    • Click the Search button...
EGL                            Introduction                           IBM Toronto Lab




The list is composed of the colu...
EGL                            Introduction                          IBM Toronto Lab




.

Now we want you create your ow...
EGL                           Introduction                     IBM Toronto Lab




   •   Right click on the WebContent di...
EGL                            Introduction                          IBM Toronto Lab




   •   Enter a name for the web p...
EGL                           Introduction                         IBM Toronto Lab




After a little while the page desig...
EGL                             Introduction                           IBM Toronto Lab




   •  Make sure the Type Select...
EGL                             Introduction                           IBM Toronto Lab




      •   Select the radio butt...
EGL                           Introduction                         IBM Toronto Lab




You will create your own buttons fo...
EGL                              Introduction                            IBM Toronto Lab




      •Click the New Variable...
EGL                             Introduction                           IBM Toronto Lab


 Now you specify the UI data cont...
EGL                             Introduction                          IBM Toronto Lab




   • Click on the Enhanced Faces...
EGL                            Introduction                          IBM Toronto Lab




   • Click on the Display error c...
EGL                            Introduction                          IBM Toronto Lab




You need to bind the error messag...
EGL                            Introduction                          IBM Toronto Lab




      • Select the heading text o...
EGL                          Introduction                         IBM Toronto Lab




       • Right click somewhere on th...
EGL                            Introduction                          IBM Toronto Lab




   You can see that two EGL varia...
EGL                           Introduction                           IBM Toronto Lab




       •   Add the word yes after...
EGL                             Introduction                              IBM Toronto Lab


   (data structure) that match...
EGL                            Introduction                            IBM Toronto Lab




   Now that you have a record v...
EGL                           Introduction                        IBM Toronto Lab




   • Add the function statement afte...
EGL                            Introduction                           IBM Toronto Lab


         •   Select SQL statement ...
EGL                           Introduction                          IBM Toronto Lab




          •   Enter the following ...
EGL                           Introduction                          IBM Toronto Lab




          •   Click on the myLogin...
EGL                           Introduction                           IBM Toronto Lab




          •    Click on the page ...
EGL                           Introduction                          IBM Toronto Lab




                                  ...
EGL                          Introduction                        IBM Toronto Lab




            •   Right click the myLog...
EGL                             Introduction                           IBM Toronto Lab



To test the error handling you b...
EGL                          Introduction                         IBM Toronto Lab




      Now let’s test a valid employe...
EGL                             Introduction                           IBM Toronto Lab




Congratulations your EGL applic...
EGL                         Introduction                     IBM Toronto Lab




   • Right clicking on a tab of one of th...
EGL                           Introduction                          IBM Toronto Lab




   •   Double click on the myLogin...
EGL                            Introduction                         IBM Toronto Lab




   • Right click on the white spac...
EGL                             Introduction                            IBM Toronto Lab




   •    Insert a blank line af...
EGL                             Introduction                            IBM Toronto Lab




 In the new line underneath th...
EGL                            Introduction                     IBM Toronto Lab




   •   Select the myLogin.jsp file in ...
EGL                            Introduction                          IBM Toronto Lab




This concludes the EGL introducti...
EGL                             Introduction                            IBM Toronto Lab



Appendix
Configure the WebSpher...
EGL                            Introduction                     IBM Toronto Lab


  • select the server right click on it
...
EGL                            Introduction                         IBM Toronto Lab


You might get asked for a user name,...
EGL                             Introduction                           IBM Toronto Lab




Configure Global Security
First...
EGL                            Introduction                          IBM Toronto Lab




Click on New button to create a n...
EGL                             Introduction                             IBM Toronto Lab


   •    Optionally provide a de...
EGL                           Introduction                         IBM Toronto Lab


Configure JDBC Provider
Now you are r...
EGL                             Introduction                          IBM Toronto Lab




    •   Select DB2 from the Data...
EGL                            Introduction                       IBM Toronto Lab




   •   Click the Next button

The su...
EGL                             Introduction                           IBM Toronto Lab




   •    Click the save link in ...
EGL                            Introduction                      IBM Toronto Lab




    • Click the Data sources link
   ...
EGL                             Introduction                           IBM Toronto Lab




   •   In the JDC name field en...
EGL                            Introduction                         IBM Toronto Lab




   •   Enter the System i server n...
EGL                           Introduction                         IBM Toronto Lab




   •   Click the save link to save ...
EGL                            Introduction                          IBM Toronto Lab




If everything was setup correct y...
EGL                           Introduction                          IBM Toronto Lab




   •   Expand the Environment node...
EGL                           Introduction                        IBM Toronto Lab




   •   Enter the path where to find ...
EGL                             Introduction                        IBM Toronto Lab




   •   Click the Save link on top ...
EGL                           Introduction                        IBM Toronto Lab




    • Click the Logout button on top...
EGL                      Introduction                      IBM Toronto Lab




Enjoy EGL and Rational Business Developer a...
Upcoming SlideShare
Loading in...5
×

iSeries EGL

1,386

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,386
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
34
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

iSeries EGL

  1. 1. EGL Introduction IBM Toronto Lab IBM Rational Business Developer Extension Version 7.0 Enterprise Generation Language (EGL) for System i Student Exercises Course code Session Id WDSc V7.0 Claus Weiss weiss@ca.ibm.com IBM Toronto Laboratory Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 1
  2. 2. EGL Introduction IBM Toronto Lab First Edition (June, 2007) The information contained in this document has not been submitted to any formal IBM test and is distributed on an "as is" basis without any warranty either express or implied. The use of this information or the implementation of any of these techniques is a customer responsibility and depends on the customer's ability to evaluate and integrate them into the customer's operational environment. While each item may have been reviewed by IBM for accuracy in a specific situation, there is no guarantee that the same or similar results will result elsewhere. Customers attempting to adapt these techniques to their own environments do so at their own risk. Comments concerning this notebook and its usefulness for its intended purpose are welcome. You may send written comments to: IBM Canada Software Solutions 8200 Warden Ave., Markham, Ontario, L6G 1C7 Attention: Claus Weiss, EGL introduction. or email to: weiss@ca.ibm.com Copyright International Business Machines Corporation 2007 All rights reserved. This material may not be reproduced in whole or in part without the prior written permission of IBM. Note to U.S. Government Users - Documentation related to restricted rights - Use, duplication or disclosure is subject to restrictions set forth in GSA ADP Schedule Contract with IBM Corp. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 2
  3. 3. EGL Introduction IBM Toronto Lab Overall Lab Guide The objective of the EGL for System i developers lab is to have the students work with an EGL application that uses a System i DB2 UDB. The lab is intended to allow hands on experience using the WDSC workbench with Rational Business Developer Extension. It shows how easy it is to re-use DB2 UDB data definitions and record definitions in an EGL web appliction Most of the Web Pages for the application are generated by the EGL Data Access Application wizard. One page is created from scratch to show how the Page Designer tool helps building powerful webpages. It is assumed that the student is familiar with basic Windows UI operations such as working with the desktop and basic mouse operations such as opening folders and performing drag-and-drop operations. Experience with an Eclipse based workbench like WebSphere Development Studio Client (WDSC) or Rational Application Developer (RAD) is an asset but is not necessary. The lab will have very detailed instructions on how to proceed. So all students can finish the Lab in their own pace. Note: The pictures in these labs show a similar application being built. Some of the names and icons may be different than the environment you are working with. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 3
  4. 4. EGL Introduction IBM Toronto Lab Trademarks IBM is a registered trademark of International Business Machines Corporation. The following are trademarks of International Business Machines Corporation. AS/400 Application System/400 VisualAge DB2/400 iSeries ILE Integrated Language Environment IBM OS/400 RPG/400 VARPG VisualAge System i Trademarks of other companies as shown 'Microsoft' 'Microsoft Corporation' 'Windows' 'Microsoft Corporation' Table of Contents EGL for System i developers...............................................................................................6 The finished application will contain the following web pages and capabilities ...........6 Creating the application.......................................................................................................9 First Steps.........................................................................................................................9 Setup the EGL Tools in the Workbench........................................................................10 Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 4
  5. 5. EGL Introduction IBM Toronto Lab Create an EGL web project ...........................................................................................14 Import Database Table Descriptions into the EGL web project ...................................21 Specifying the runtime environment for the EGL web application ..............................39 Running the generated Web pages.................................................................................51 Creating a new Login web page ..................................................................................56 Writing EGL code for the web page .............................................................................68 Testing the application...................................................................................................79 Adding code to change at runtime UI control attributes................................................83 Appendix............................................................................................................................91 Configure the WebSphere Application Server..............................................................91 Start the server and run the administrative console ..................................................91 Configure Global Security.........................................................................................94 Configure JDBC Provider..........................................................................................97 Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 5
  6. 6. EGL Introduction IBM Toronto Lab EGL for System i developers This document provides basic procedures for creating a Dynamic Web project, configuring EGL, getting database definitions from a System i, working with webtools plus Rational Business Developer Extensions and writing some EGL code. The finished application will contain the following web pages and capabilities You will create a web application with 3 web pages: • A login page that has two input fields, and some error handling for these fields • If the correct username has been entered then the application will display a second web page. You will write the logic to access an employee database to check the username against the employee database. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 6
  7. 7. EGL Introduction IBM Toronto Lab • The second page shows a search field that allows to filter customer names in a customer database base table and then list the customers fitting the search criteria in a list on the web page • From this list the user can then select a specific customer to work with • Clicking on a customer number will show this detail customer data web page. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 7
  8. 8. EGL Introduction IBM Toronto Lab • All fields from the System i table(file) are displayed as input fields and buttons are available to update the record, or delete the current record. Now you know what you have to build in this Lab. Lets get started, just follow the detailed instruction in this lab script and you will learn how easy it is to write an EGL data access application. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 8
  9. 9. EGL Introduction IBM Toronto Lab Creating the application First Steps You need to start the WDSC workbench and select a workspace that contains all the files you use for your development project. You will use a new workspace so your environment fits the environment we used when we created this script. Start WDSC V 7 • Click Start All programs  IBM Software Development Platform  WebSphere Development Studio Client Advanced Edition for iSeries  WebSphere Development Studio Client Advanced Edition for iSeries • When prompted for a workspace name Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 9
  10. 10. EGL Introduction IBM Toronto Lab • Enter a new name, like in the figure above, so you get a brand new workspace • Click OK • The workbench will show: • Click the x on the Welcome tab to remove the Welcome page. Setup the EGL Tools in the Workbench Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 10
  11. 11. EGL Introduction IBM Toronto Lab BEFORE CREATING A PROJECT you should setup the EGL environment to reflect your needs. You customize your workbench environment by using the preference dialog. For this exercise you will change the defaults for converting System i DB2 UDB data types. Just follow the steps below to change the default for the transformation of data base character fields variables on your System i to EGL data items of type character. The default is to transform them to string type data items. • First select the Window action from the workbench menu. • Select Preferences from the context menu The Preferences dialog will open. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 11
  12. 12. EGL Introduction IBM Toronto Lab • Expand the EGL node in the preferences tree (click the +) Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 12
  13. 13. EGL Introduction IBM Toronto Lab • Click on SQL inside the EGL node • In the EGL type to use for columns containing an SQL character data type • Select Use EGL type char This will create EGL data items of type char instead of the default type string • Click the OK button to apply your changes. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 13
  14. 14. EGL Introduction IBM Toronto Lab Create an EGL web project The following steps will guide you through the creation of a Dynamic Web Project that is used in this Lab and contains your EGL application source and meta data information. You will be using the Web perspective with all the views and editors needed to work with a web application. Switch to the Web perspective by: • Clicking on the open perspective icon on top right hand side of the workbench • Selecting the Other… action from the context(pop up) menu The Open Perspective dialog shows: Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 14
  15. 15. EGL Introduction IBM Toronto Lab • Select Web from the tree in the Open Perspective dialog Now you are ready to create a new Dynamic web project. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 15
  16. 16. EGL Introduction IBM Toronto Lab • Right click on the white space in the Project explorer view • Select New on the pop up menu (or select the New action under File on the workbench menu) • Select Dynamic Web Project In the Project wizard dialog Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 16
  17. 17. EGL Introduction IBM Toronto Lab • Provide a Project name – we used EGL_lab • Make sure WebSphere Application Server v6.1 is the target runtime • Select Faces Project as the Configuration for this project • Make sure the EAR project name is the same as the project name with the word EAR appended, in the picture the name is: EGL_labEAR. • Click the Next > button To add all necessary support for this web application select the facets you need for this web application. You will work with a Default style sheet (CSS file) and EGL so you need to select three additional facets for this web project. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 17
  18. 18. EGL Introduction IBM Toronto Lab • Select Default style sheet(CSS file) • Select EGL support with JSF • Select EGL support with JSF component interface • Click the Next > button Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 18
  19. 19. EGL Introduction IBM Toronto Lab • Accept the defaults on this dialog , • Click the Next > button Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 19
  20. 20. EGL Introduction IBM Toronto Lab • Make sure the radio button Create new project build descriptors is selected • Provide the JNDI name to connect to your iSeries database. We used: jdbc/s400a. The format is always jdbc/xxxxx . • Click the Finish button The wizard will now create your EGL web project Your workspace should now look similar to the following illustration. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 20
  21. 21. EGL Introduction IBM Toronto Lab In the workbench • Expand your project. • Spend a few moments and explore the directories and artifacts created by the wizard for you. You will be working extensively in the “EGL Source” directory. Clean up the workbench views by closing all unnecessary views: • Right click on one of the tabs in the editor area • Select the close all action from the pop up menu Import Database Table Descriptions into the EGL web project In this step, you will connect to your System i and import the table definitions for the database tables used in this project. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 21
  22. 22. EGL Introduction IBM Toronto Lab • Select your project and right click to display the context menu. • Select the New action from the context Menu • Select Other… from this menu. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 22
  23. 23. EGL Introduction IBM Toronto Lab You want to create an application that accesses the System i DB2 UDB, so you will create an EGL Data Access Application In the Select a wizard dialog: • Locate and expand the EGL node in the tree. • Select EGL Data Access Application • Click the Next > button You will now create a new database connection for this project. If you already had specified a database connection before you could re-use this connection instead. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 23
  24. 24. EGL Introduction IBM Toronto Lab • Select your project EGL_lab • Click the New.. button to create a new Database Connection You now have to specify the connection information like what relational database you want to use and where this database is located. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 24
  25. 25. EGL Introduction IBM Toronto Lab On the New Connection dialog: • Expand DB2 UDB iSeries in the Select a Database manager tree view • Select V5R4 • Specify the System i host name (s400a is being used in the picture) • Specify Userid and password o User id WLABxx (xx being your team number) o Password wxx (xx being your team number) • Click the Test connection button Hopefully you will see a message box indicating successful connection. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 25
  26. 26. EGL Introduction IBM Toronto Lab • Click the OK button • Click the Next > button on the New connection dialog Now you have to specify which schemas (libraries) your tables (database files) are located in. In this Lab you are working with one schema only. To select the schema follow the instructions below • Deselect the Check box Disable filter • Select the Radio button Selection • From the list of schemas (libraries), select EGLLABV7xx (xx being your team number) • Click the Finish button Now you need to select the tables you need in this application inside the schema. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 26
  27. 27. EGL Introduction IBM Toronto Lab For each of the tables, you will then select which columns(fields) you will work with in the application you are building In the EGL Data Access Application dialog • Select the tables as shown in the picture above • Select the check box for Create web pages, this will cause the EGL wizard to create two Web pages for each table. These tables can be used later in the EGL web application We will now walk through the steps necessary to map database tables into EGL for use as record descriptions and to generate the basic SQL data access functions that you can then use in the EGL application. In addition you need to specify what information should appear on the web pages for each of the tables. So the wizard can generate the base web pages for your application. Each table is represented in a tab in the following dialog. For each table you need to specify the key fields to be used and the Search fields. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 27
  28. 28. EGL Introduction IBM Toronto Lab In this application you will just use the customer table, so in this lab you can skip the customization for the other tables. We wanted to show you however that you can easily work with multiple tables in an EGL project. The Search fields are the fields that allow the end user to subset the data they want to see in the list pages for these tables. • For the Customer table select search field Last_Name • For the Department and Employee tables there is no Search field needed Select the Key fields and Search fields for the remaining tables according to the instructions for each of them. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 28
  29. 29. EGL Introduction IBM Toronto Lab For Item: • Select ITEM_ID as key field • Select Name as Search field Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 29
  30. 30. EGL Introduction IBM Toronto Lab For Orders: • Select Order_ID and Customer_ID as Search fields • Click the Next > button Now you can customize the heading that appears in the User Interface for each column in the tables, you can also select the columns to be shown in the lists of data for each table that will be shown on the web page after the end user selected the Search criteria Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 30
  31. 31. EGL Introduction IBM Toronto Lab • Fix up some of the headings to see what effect this has on the generated web pages (in the picture above Customer_ID) Also select the columns to show in the list of records (subfile) • For table Customer select the four columns to be shown in the list. For the other tables • Select the columns as shown in the pictures Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 31
  32. 32. EGL Introduction IBM Toronto Lab Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 32
  33. 33. EGL Introduction IBM Toronto Lab Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 33
  34. 34. EGL Introduction IBM Toronto Lab Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 34
  35. 35. EGL Introduction IBM Toronto Lab • Click the Next > button Now you need to specify some code generation information. Do you want to generate the data access function as a service or as a function in an EGL application? In this Lab you will use the data access functions internally in EGL applications so EGL will create functions a library that can be used by other EGL applications. Do you want to qualify the SQL access with the schema name? If not, the default for the JDBC driver is to use the schema name corresponding to the user id when using SQL naming rules. If you want to use a selection according to the job library list you will need to specify, later when establishing the runtime connection, that you want to use System naming rules. For this Lab use the full qualification of the table name Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 35
  36. 36. EGL Introduction IBM Toronto Lab • Make sure that the selected Data access method is EGL libraries • Select Qualify table names with schema • Click the Next > button Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 36
  37. 37. EGL Introduction IBM Toronto Lab The summary shows what has been selected, you can go back to make corrections if needed. • Click the Finish button Code generation will take a short while. If you see a red x on your project icon, you will need to regenerate your project. This happens sometimes because of synchronization problems. Things are not ready as they are needed for other tasks. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 37
  38. 38. EGL Introduction IBM Toronto Lab In case you have generation errors. • Right click on your project • Select generate from the pop up menu Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 38
  39. 39. EGL Introduction IBM Toronto Lab Specifying the runtime environment for the EGL web application Now you are ready to show data on the generated web pages But before you can run the application you need to specify the data source to be used at runtime, so the application server knows where the database is located and what database driver to use. You have a choice of specifying the data source at the application server level using the application server administration console or at the application level using the EAR file descriptor. Specifying the information in the EAR file only makes the information available for this application, specifying it in the Application Server makes it available for all Web applications running in the Application Server. Let’s use the EAR file for this project. • Expand the EAR node in the Project explorer tree view • Double click on the Deployment descriptor node This will open the Deployment descriptor editor • Click on the Deployment tab in the editor You now have to specify the Data Source information, part of this information is the authentication data. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 39
  40. 40. EGL Introduction IBM Toronto Lab • Scroll down in the editor to the Authentication area • Expand Authentication • Click the Add… button • Specify an alias name (any name will do) • Specify the userid for your runtime System i (in this case same as the development system WLABxx) • Specify the password (Wxx) Now you need to specify the JDBC provider. Since you are using a DB2 UDB on System i fill out the following information. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 40
  41. 41. EGL Introduction IBM Toronto Lab • Scroll up to the top in the editor • Click the Add button for the JDBC provider list You will use the iSeries toolbox JDBC driver Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 41
  42. 42. EGL Introduction IBM Toronto Lab • Select the IBM DB2 database type • Select the DB2 UDB for iSeries (Toolbox) JDBC provider type • Click the Next… button The wizard needs to give this provider a specific name, so you have the choice of using different providers in the same applicaton. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 42
  43. 43. EGL Introduction IBM Toronto Lab • Specify a name for the provider (any name will do) • Click the Finish button Now you need to specify the specific database you want to access using the driver you specified. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 43
  44. 44. EGL Introduction IBM Toronto Lab • Click the Add button for the Data source defined in the JDBC provider selected above You will use the iSeries toolbox driver. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 44
  45. 45. EGL Introduction IBM Toronto Lab • Select the DB2 UDB for iSeries (Toolbox) provider type • Click the Next > button Now specify the JNDI name that you have used in the project t creation wizard. Note: This name is case sensitive so be careful and use the exact same name as before in the project wizard (suggested name was jdbc/s400a) The authentication alias to be used for this database access has to be specified as well. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 45
  46. 46. EGL Introduction IBM Toronto Lab • Specify the JNDI name that you used when you created the EGL project (we suggested to use jdbc/s400a) • Specify the authentication to be used for both Component managed and Container managed (use the alias that you created earlier) • Click the Next > button The wizard will now prompt for any required information for this JDBC driver. The server or database name is a required value. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 46
  47. 47. EGL Introduction IBM Toronto Lab • Specify the server name (in this case s400a) • Click the Finish button You will need to add some more information 1. The location of the JDBC driver 2. The date format to be used For the location of the JDBC driver you will need to add a new variable, follow the instructions below. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 47
  48. 48. EGL Introduction IBM Toronto Lab • Scroll down to Substitution variables • Click the Add button • Specify the name of the variable which is: OS400_JDBC_TOOLBOX_DRIVER_PATH • Specify the location which is: C:/Program Files/IBM/SDP70Shared/plugins/com.ibm.etools.iseries.toolbox_7.0.1.v2007052 80055/runtime Note: Forward slashes are used in this path statement Now you need to specify the date format, a variable name for this information has already been created. The database tables contain date columns in iso format to make sure this Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 48
  49. 49. EGL Introduction IBM Toronto Lab format is used when getting the data, you need to specify this information so the JDBC driver sets up the connection accordingly. In the list Resource properties defined in the data source selected above: • Scroll to Name dateFormat • Select dateFormat • Click the Edit button • Specify iso in the value field • Click the OK button You are done and can save the Deployment descriptor now. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 49
  50. 50. EGL Introduction IBM Toronto Lab • Save the Deployment descriptor by clicking on the Save icon To make sure the JNDI name in the EGL build descriptor and in the application runtime are the same, check the EGL build descriptor. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 50
  51. 51. EGL Introduction IBM Toronto Lab • Expand the EGLSource directory • Double click on the .eglbld file • In the edit window make sure the checkbox Show only specified options is checked • Make sure option sqlJNDIName is the same as the JNDI name that you specified in the EAR file deployment descriptor. (Make sure the Value is exactly the same it is case sensitive) Running the generated Web pages You are ready to run the Web pages and try them out. The generated web pages have been created in the WebContent directory in you project. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 51
  52. 52. EGL Introduction IBM Toronto Lab • Expand the WebContent folder • Select and right click one of the ListPage.jsp files (in the picture we used the customerListPage.jsp file) • Select RunAs from the pop up menu • Select Run on Server from the pop up menu If you don’t have a default server specified you will see a dialog like this show up Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 52
  53. 53. EGL Introduction IBM Toronto Lab • Select WebSphere Application Server v6.1, if given a choice • Select the Set sever as a project default checkbox • Click the Finish button. If the dialog doesn’t show up you are fine this dialog will not show and the web page will show up in the browser window. Your browser should show a page similar to the picture below Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 53
  54. 54. EGL Introduction IBM Toronto Lab • Click the Search button • Notice Last name is the column you selected when specifying the search field for the customer table to be used in the EGL data access application wizard. The condition field allows to filter for specific customers to be listed, in this case you don’t use any condition, then all customers in the database will be shown. You will see a list of customers show up Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 54
  55. 55. EGL Introduction IBM Toronto Lab The list is composed of the columns you selected in the data access application wizard. The key column is a link that allows the user to select a specific record to display all fields in an update/delete page. • Click on the link for one of the customer numbers The details page for this customer will show. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 55
  56. 56. EGL Introduction IBM Toronto Lab . Now we want you create your own login web page and write some EGL code to validate the username from the login page against the employee database table. • Right mouse click on the Browser tab and select Close all, to close all editor and browser windows that might be open. Creating a new Login web page To create a new web page you will use the web page wizard and the page designer , both these tools are part of the web tools that come with WDSC, the page designer supports design of java server faces web pages and also has some additional capabilities to provide tight integration with EGL. Since all your webpage are located in the WebContent directory the new page should also be stored in there. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 56
  57. 57. EGL Introduction IBM Toronto Lab • Right click on the WebContent directory • Select New from the pop up menu • Select WebPage from the content menu The new WebPage wizard dialog appears Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 57
  58. 58. EGL Introduction IBM Toronto Lab • Enter a name for the web page (we used myLogin.jsp) • Click the Finish button The page designer gets invoked and you can start to create the visual layout of your web page. The goal is to create a page with two input fields: - username - password Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 58
  59. 59. EGL Introduction IBM Toronto Lab After a little while the page design editor will show • Make sure the Design tab at the bottom of the editor is selected • Enter a heading at the top of the page • Click the Enter key a couple if times to add some space underneath the heading Now create an EGL variable and an input field on the web page by going thru these steps • Select the New variable icon in the EGL drawer A retangle will appear in the designer, representing a form that is getting created • Click inside this rectangle The Create a new EGL variable wizard appears Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 59
  60. 60. EGL Introduction IBM Toronto Lab • Make sure the Type Selection radio button Primitive is selected • Enter a name for the field e.g. username • Select Data Type char and Dimensions 10 for your 10 character username • Make sure the check box Add controls to display the EGL element on the Web page is selected, this invoke a wizard to specify the input field characteristics. • Click the OK button The Configure data controls dialog shows Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 60
  61. 61. EGL Introduction IBM Toronto Lab • Select the radio button Updating a exiting record, if not already selected, this will give the UI control input capabilities • You might want to change the label by just clicking on it in the list (in the picture we left it unchanged) • Click the Options… button The option dialog allows you to specify additional options for this UI control, one of these options is the automatic generation of submit and delete buttons for the page. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 61
  62. 62. EGL Introduction IBM Toronto Lab You will create your own buttons for this web page later in this exercise: • Unselect the check box for the Submit button • Unselect the check box for the Delete button • Click the OK button Back in the Configure Data controls dialog • Click the Finish button The web page in the page designer tool now contains an input field with the correct heading. An error message to display jsf runtime messages has automatically been added. You need to make some space for the password input field and a push button. • Left click in front of the Error Message control • Then click the Enter key three times This moves the Error Message control down and allows you to add the password input field. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 62
  63. 63. EGL Introduction IBM Toronto Lab •Click the New Variable control to select it •Click underneath the Username control in the design panel to indicate where you want to position this new control The New EGL Data Variable dialog appears • Enter password for the name of the field • Enter 10 as a value for the dimension of the character field • Click the OK button Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 63
  64. 64. EGL Introduction IBM Toronto Lab Now you specify the UI data control properties, since this is a password field you will specify that the data should be shown as secret data. • Click the little arrow beside the Control Type column in the fields list • Select the Secret Input Field from the Combo box • Click the Finish button Now your page also contains a password input field. You will add two error message controls that are directly linked to jsf validation error messages for the specific fields. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 64
  65. 65. EGL Introduction IBM Toronto Lab • Click on the Enhanced Faces Component Drawer in the Palette This expands the drawer and you can now select from a wide variety of UI controls • If you can’t see the Display Error controls, click on the little triangle at the bottom of the Enhanced Faces drawer to scroll up. When you see the Display error control Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 65
  66. 66. EGL Introduction IBM Toronto Lab • Click on the Display error control (not the Display errors control underneath) • Click behind the username control, (this will position the error control behind it.) For the password control do the same • Click on the Display error control (not the Display errors control underneath) • Click behind the password control, (this will position the error control behind it.) You are almost done with the user interface design, you only need to adjust some properties. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 66
  67. 67. EGL Introduction IBM Toronto Lab You need to bind the error message controls to the input field controls, at the moment they are just positioned close to each other, but the jsf framework doesn’t know that you want to link these controls together. • Select the Error Message control behind the username input field • Click on the Properties tab underneath the page design editor • In the Display error messages for this component input field click the expansion button on the side of the input field • From the list select the username control Now you need to do the same for the other Display error message control, just select the error control behind the password input field for this one and select the password input field to be linked. You now want to enhance your title for this page Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 67
  68. 68. EGL Introduction IBM Toronto Lab • Select the heading text on the page The properties for the text get shown in the properties dialog • For the Paragraph type, select Heading 2 Writing EGL code for the web page Now you specify some validation rules for the username field in EGL and you will write the validation routine that checks that the username keyed in on this page, is an employee of the company by comparing it with the employee database. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 68
  69. 69. EGL Introduction IBM Toronto Lab • Right click somewhere on the white space in your web page • Select Edit Page Code from the pop up menu The source editor will show, it contains EGL code that has been generated when you worked with the page designer tool. All pages in an EGL web application have individual EGL Page code attached to them. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 69
  70. 70. EGL Introduction IBM Toronto Lab You can see that two EGL variables (username/password) have been generated for you. You will now add additional properties to the username variable. In EGL properties for variables are specified inside curly brackets. You want to make sure that the user keys in a username, jsf can check this for you, and you want to uppercase any input so it easily matches the employee last names in the database. • At the end of the username variable statement, before the semicolon insert a curly bracket {, the corresponding } will be inserted automatically. • Position the cursor inside the {} brackets • Press ctrl + space bar this shortcut will invoke the content assist feature in source editors in the Eclipse workbench (this is true for the RPG source editor as well as Java) • In the content assist list scroll down to InputRequired and double click on this property The InputRequired = string will be inserted inside the curly brackets Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 70
  71. 71. EGL Introduction IBM Toronto Lab • Add the word yes after the = sign • Add a comma after the yes • Ctrl + space bar again • Now select UpperCase from the list • Add the word yes after the = sign You need to get (read) a row from the employee table that where the Last name is the same as the username. In order to get a row we need to store the data in a record Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 71
  72. 72. EGL Introduction IBM Toronto Lab (data structure) that matches the column layout of the employee table. In EGL records are equivalent to data structures in RPG. So we need to define a record variable (like specifying a data structure name in a D spec). The layout of this record variable is like the column layout of the employee table. The name we use for this variable is empl. • Position the cursor after the semicolon in the password definition • Click the enter key, to add a new line • For the name of the variable enter empl in the new line • Add a blank (blank delimits the variable name) • Enter the character e as a starting character for the data type of this variable, (this will filter the content assist list to available data types that start with e) • Click ctrl + space bar • Select the Employee – torasedu data(record) (in your case s400a instead of torasedu) from the list, (the record data type for each table from the Data Access Application wizard was generated for all tables that you selected to work with) • Add a semicolon at the end of the finished data definition statement Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 72
  73. 73. EGL Introduction IBM Toronto Lab Now that you have a record variable defined you can write the get statement to retrieve the data into the variable. You will create a new function (procedure) named validate to get the employee record. Notice that there is already one function defined in this EGL source file, it is called onConstruction. This function is called every time before the associated page to this file is loaded. If you want to add data to the page or change its look before the user sees it, this is the place to add the code to do this. Go ahead and create the new validate function Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 73
  74. 74. EGL Introduction IBM Toronto Lab • Add the function statement after the end statement of the onConstruction function • Add the get empl ; statement • Position the cursor between the empl and semicolon and right mouse click We want you to modify the default SQL statement that is associated with a get to the employee table. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 74
  75. 75. EGL Introduction IBM Toronto Lab • Select SQL statement from the pop up menu Note: It is important that the cursor position is correct, right before the semicolon when you right mouse click • Select Add from the pop up menu This will add an SQL statement into your source. Now you have to customize this SQL statement so the where clause reflects that you want to get a row where the LASTNAME column matches the input from the username field. • In the SQL statement change the where clause to EGLLABV7XX.EMPLOYEE.LASTNAME=:username • You will need to add some code that handles the condition that a matching employee has been found or not found. The information what happened to this get request is returned in a SQL return code. You need to add a couple of lines of EGL code that handles a found/not found condition after this SQL statement. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 75
  76. 76. EGL Introduction IBM Toronto Lab • Enter the following code after the end of the SQL statement if(sysvar.sqlData.sqlcode != 0) syslib.setError("Please enter a valid username"); else forward to "customerListPage"; end end • Use content assist to help you writing the code The two end statements are needed to end the if statement and to end the function. You are almost done, save the changes • Click ctrl + s, to save. If there are problems in your code the lines with errors are marked with a red icon. • Fix any problems EGL will re-generate the underlying code as you save these page code files. After everything is fixed there is one more task and then you are done with this page. You need a way of invoking your validate function. To accomplish this go back to the page design editor. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 76
  77. 77. EGL Introduction IBM Toronto Lab • Click on the myLogin.jsp editor tab to get back into page designer Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 77
  78. 78. EGL Introduction IBM Toronto Lab • Click on the page data view tab, in the left bottom corner of the workbench • Expand the JSF handler node You see all EGL variables defined in the page code file for this page, you also see the functions available in the page code file. You need to invoke the validate function from the page. • Select the validate function in the page data view • Drag it with your mouse onto the page in the page design editor You will see the tool creates a validate button on the page Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 78
  79. 79. EGL Introduction IBM Toronto Lab . • Save the page by clicking ctrl + s Now you are ready to test your new page and the EGL code. Testing the application You will run the application again but now starting with the Login page. You will check the UI constrain that requires input for the username input field and you will check that your code is working, comparing the username input against the employee table. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 79
  80. 80. EGL Introduction IBM Toronto Lab • Right click the myLogin page in the WebContent directory • Select RunAs  Run on Server Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 80
  81. 81. EGL Introduction IBM Toronto Lab To test the error handling you built into this page: • Click the validate button You see the validation message for the jsf message that input is required, it is handled as a username field error since it is triggered thru the EGL Input required attribute that you set to yes. The jsf framework is doing the check for you and issuing the message. Next you test the error routine that you created in the EGL page handler validate function. • Key in a name that is not in the employee data base (weiss is a name that is not in there) • Click the Validate button You see that your user defined error message appears in the message control at the bottom of the page. You also notice that the username is uppercased. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 81
  82. 82. EGL Introduction IBM Toronto Lab Now let’s test a valid employee name • Key in a valid username (haas is in the data base) • Click the validate button Now you see the customer list page that you specified to forward to in the EGL code. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 82
  83. 83. EGL Introduction IBM Toronto Lab Congratulations your EGL application works. Adding code to change at runtime UI control attributes If you still have time you can enhance the login page be coloring the input field in error in addition to showing the error message it self. EGL provides some cool interfaces that allow you work with control attributes directly from EGL without having to write Java script code. Clean up the workbench and close all editor views by: Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 83
  84. 84. EGL Introduction IBM Toronto Lab • Right clicking on a tab of one of the open editors • Selecting the Close All action from the pop up menu • Now open the Login.jsp Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 84
  85. 85. EGL Introduction IBM Toronto Lab • Double click on the myLogin.jsp file in the Project Explorer view The page designer tool opens with the web page. Now open the source editor with the EGL page handler code. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 85
  86. 86. EGL Introduction IBM Toronto Lab • Right click on the white space in the Design page of the page design tool • Select the Edit Page Code action on the pop up menu • The source editor opens the myLogin.egl file. You will add code into the not found branch of the if statement you created before. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 86
  87. 87. EGL Introduction IBM Toronto Lab • Insert a blank line after the if(sysvar… ) statement by clicking the Enter key at the end of the statement. • Click the key combination ctrl+shift+z This brings up a dialog showing all controls on the web page in a tree view • Select the textUsername1 control in the tree view • Click the OK button Two EGL statements get added, for setting up an environment that allows you to access the attributes of this user name UI control on the web page. The definition of a variable textUsername1 has been added and a statement that stores a reference to the username control into the variable. You can now use this variable to access attributes for this control. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 87
  88. 88. EGL Introduction IBM Toronto Lab In the new line underneath the second statement that got added in the previous step: • Key in the variable name that was created in the previous step (in the sample picture above textUsername1) and a period indicating you want to invoke a function to access attributes for this control . • Click ctrl+spacebar (content assist) for a list of all function supported for this UI control • Scroll down to the setStyle(StyleString) this allows you to change the control style by providing the value of the style a string. You want to change the background color of the username variable to red if the error condition is true. Inside the bracket after the word setStyle: • Enter the following: “background-color:red” If you have worked with web styles before you will notice that this is the normal syntax for style definitions • Add a semicolon after the bracket • Click crtl+s to save the file • Fix errors if you got some showing up • Test your new feature Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 88
  89. 89. EGL Introduction IBM Toronto Lab • Select the myLogin.jsp file in the Project Explorer • Select Run As on the pop up menu • Select Run on Server On the Login page: • Key in a wrong employee number (e.g. weiss) • Click the validate button • The username field will appear with a red background. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 89
  90. 90. EGL Introduction IBM Toronto Lab This concludes the EGL introduction hands-on Lab, we hope you enjoyed the experience. Give EGL a try, write new applications or modernize existing applications. The appendix in this document shows how to create a data source definition in the WAS 6.1 environment instead of the EAR build descriptor that you used in this Lab, it is for your information to help you setting this up in your own environment at home, don’t use it here in the lab. Some more comments if you want to try EGL at home. Using WDSc V7, you can download a free, time limited trial version, of EGL from the following website. http://www.ibm.com/developerworks/downloads/r/rbex/? S_TACT=105AGX15&S_CMP=LP Or check the IBM developer works website for Rational Business Developer. http://www.ibm.com/developerworks Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 90
  91. 91. EGL Introduction IBM Toronto Lab Appendix Configure the WebSphere Application Server A full function instance of the WebSphere Application Server is installed on your workstation. You already used it in this hands-on lab to test your application. In the Lab you defined the data source information on an application base using the EAR file deployment descriptor, in this appendix you learn how to set up the data source information for a System i data base for all applications running in application server. These instruction are for WAS 6.1, the WAS administration console screens are a bit different from version to version, so if you have WAS 6.0 that you have to set up you should still be able do this with these instructions, the steps are the same the screens look a bit different. Start the server and run the administrative console You will need to invoke the WAS admin console first. For this the server has to be started, if it is not started. In the server view at the bottom of the workbench. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 91
  92. 92. EGL Introduction IBM Toronto Lab • select the server right click on it • and select the Start action from the pop up menu Now with the server in started mode, run the Admin Console In the servers view at the bottom center of your workspace • Right mouse click on the server you want to set up • Select action Run administrative console Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 92
  93. 93. EGL Introduction IBM Toronto Lab You might get asked for a user name, then use your name, this doesn’t have to be any registered user, any name will do. • .Enter a User ID • Click the Log in page The administrative console appears in the browser window Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 93
  94. 94. EGL Introduction IBM Toronto Lab Configure Global Security First you will need to create a JAAS J2C Authentication entry to pass a userid and password to the System i. • Click the Security tab’s plus sign to expand its choices in the left menu. • Click on Secure administration, applications . The body of the page valid for this action will be displayed in the right hand side. • Scroll to the right until you can see the Authentication options • Expand “Java Authrntication and Authorization Services” • Click on “J2C authentication data”. Now you can add an entry for the System i authentication Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 94
  95. 95. EGL Introduction IBM Toronto Lab Click on New button to create a new entry. The dialog for entering a new authentication entry opens. • Enter an alias name, you will use this alias name later when defining the System i UDB DB2 datasource. Any name will do • Provide a userid that is valid for accessing the System database (your own or other designated profile). • Provide the Password for this user profile Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 95
  96. 96. EGL Introduction IBM Toronto Lab • Optionally provide a description of this authentication entry. • Click the OK button Your Global Security web page should be similar to the one depicted above. Note the messages at the top of the page. When you modify the WebSphere console configuration you must save it. • Click the word Save (Blue with underscores) in the gray box at the top of the screen. • Click the Save button to save your changes. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 96
  97. 97. EGL Introduction IBM Toronto Lab Configure JDBC Provider Now you are ready to define the database provider and datasource • Expand the Resources node • Expand the JDBC node • Click on the JDBC provider node If you already got a DB2 UDB for iSeries (toolbox) provider in the list of JDBC providers than go directly to configuring a data source other wise • Click the New button Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 97
  98. 98. EGL Introduction IBM Toronto Lab • Select DB2 from the Database type drop down list. • Select DB2 UDB for iSeries (ToolBox)” from the Provider type drop down list. NOTE: be certain to select the “ToolBox” choice and NOT “Native”. • From Implementation type drop down list, choose Connection pool data source. • Click the Next Button On the next panel accept the default for the variable name containing the driver path. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 98
  99. 99. EGL Introduction IBM Toronto Lab • Click the Next button The summary page appears • Review the data displayed in the dialog. • If everything seems correct click the Finish button The JDC providers list appears again, now containing the new provider you have added Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 99
  100. 100. EGL Introduction IBM Toronto Lab • Click the save link in the Messages box on top of the screen • Be sure to click the “Save” button in the next dialog • In the provider list click the provider Link that you just added to create a data source for this provider. In the following dialog for this provider Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 100
  101. 101. EGL Introduction IBM Toronto Lab • Click the Data sources link • A list of data sources will appear • Click the New button Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 101
  102. 102. EGL Introduction IBM Toronto Lab • In the JDC name field enter the jndi name that you use in your EGL project • You used jdbc/s400a in this hands on lab Note: This name is case sensitive • Also enter the authentication to be used for this data source, select the alias you created earlier in this appendix. • Click the Next button Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 102
  103. 103. EGL Introduction IBM Toronto Lab • Enter the System i server name, depending on your network you might have to add the entire domain name. • Click the Next button • Click the Finish button after verify everything is correct Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 103
  104. 104. EGL Introduction IBM Toronto Lab • Click the save link to save this configuration • Select the Select check box for your JDBC provider to test the connection information • Click the Test connection button Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 104
  105. 105. EGL Introduction IBM Toronto Lab If everything was setup correct you will get a message indicating a successful connection has been made. Ignore any warning messages. One more step and you are done. You need to specify the path to the toolbox driver. In an earlier step you provided a variable name to contain this path information. Now you have to fill the variable with the path information. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 105
  106. 106. EGL Introduction IBM Toronto Lab • Expand the Environment node on the left side of the admin console • Click on the WebSphere Variables node • Scroll down until you see the OS/400 toolbox JDBC Driver Path link in the list of variables • Click on the link to add a value to this variable Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 106
  107. 107. EGL Introduction IBM Toronto Lab • Enter the path where to find the toolbox driver . The default location in WDSC V7 is this. C:/Program Files/IBM/SDP70Shared/plugins/com.ibm.etools.iseries.toolbox_7.0.0.v2007020 12355/runtime Note: Be aware of the forward slashes instead of the default Windows backward slashes for separating directories Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 107
  108. 108. EGL Introduction IBM Toronto Lab • Click the Save link on top of the variables list page You can check the path information By checking the OS/400 Toolbox value entry in the variables list (The picture shows our path info which shows the D: drive being used since our WDSC installation used this drive). Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 108
  109. 109. EGL Introduction IBM Toronto Lab • Click the Logout button on top of the administration console page Now you have setup the WAS environment and all application running on this server can use the JNDI name jdbc/s400a to connect to this DB2 UDB database on your System i. Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 109
  110. 110. EGL Introduction IBM Toronto Lab Enjoy EGL and Rational Business Developer and write great System i applications with this powerful tool Monday, July 19, 2010 © COPYRIGHT IBM Corporation 2007 Page 110

×