Intro to Application Express


Published on

Linnemeyer Larry - Intro to Application Express

Published in: Technology, Business
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Intro to Application Express

    1. 1. Introduction to Application Express (formerly HTML DB) By Larry Linnemeyer, TUSC
    2. 2. Abstract <ul><li>You may have heard about Oracle Application Express or HTML DB. This tool is Oracle's scaled down version of Oracle Portal. It's a powerful and easy way to quickly develop a database-centric HTML Web application. You can install APEX on your own machines or run in a hosted environment on Oracle's site. All development (construction of pages) is done through the browser interface. You can use the SQL Workshop and the Data Workshop to run SQL and add data to your environment. This easy-to-use tool will impress you in no time at all! </li></ul>
    3. 3. Agenda <ul><li>APEX Defined </li></ul><ul><li>Uses – who, what, when, where, why </li></ul><ul><li>Building applications with APEX </li></ul><ul><li>APEX Administration and Monitoring </li></ul><ul><li>Tips and Techniques </li></ul>
    4. 4. APEX Defined
    5. 5. What is APEX? <ul><li>Oracle’s answer to “Wizards” </li></ul><ul><li>Meta Data (lots of it!) </li></ul><ul><li>Dynamic HTML (fast!) </li></ul><ul><li>PL/SQL - No Java </li></ul><ul><li>Does anything you can do in SQL or PL/SQL </li></ul><ul><li>Nice Web-based team development environment </li></ul>
    6. 6. It’s Origin <ul><li>Originated from Tom Kyte’s “ASK TOM” site </li></ul><ul><li>Used mod_plsql to develop </li></ul><ul><li>Became “Project Marvel” then HTML DB </li></ul><ul><li>Now it’s APEX </li></ul><ul><li>Also referred to as Einstein </li></ul>
    7. 7. You’re a good candidate for APEX if you fit the following profile <ul><li>You are, or have developers who are, skilled in SQL and PL/SQL </li></ul><ul><li>Your application is database-centric </li></ul><ul><li>Your application can be developed using a hosted service </li></ul><ul><li>You are comfortable with a declarative/4GL programming model </li></ul><ul><li>You want to migrate an Access / Excel application to Oracle </li></ul>
    8. 8. Scalable? <ul><li> </li></ul><ul><li>5,500 active workspaces </li></ul><ul><li>Dell 6550 4x2.0 Ghz Xeon Processors </li></ul><ul><li>6 GB RAM </li></ul><ul><li>Red Hat AS 2.1 </li></ul><ul><li>5,500+ schemas </li></ul><ul><li>DB Size ~75 GB </li></ul><ul><li>SGA Size ~1.5GB </li></ul><ul><li>Average Unique Page Views: 25,000+ per weekday </li></ul><ul><li>Average Page View Time: <.5 seconds </li></ul><ul><li>1 DBA – manages 15 other DBs </li></ul>
    9. 9. Major Components <ul><li>Administration </li></ul><ul><li>SQL Workshop </li></ul><ul><li>Application Builder </li></ul>
    10. 10. Components <ul><li>SQL Workshop </li></ul><ul><ul><li>Interact with your database as with SQL*Plus, but visual </li></ul></ul><ul><ul><li>Data dictionary and object browsing, query by example </li></ul></ul><ul><li>Administration </li></ul><ul><ul><li>Manage users </li></ul></ul><ul><ul><li>Manage services </li></ul></ul><ul><ul><li>Monitor activity </li></ul></ul><ul><li>Application Builder </li></ul><ul><ul><li>Centerpiece of APEX </li></ul></ul><ul><ul><li>Loaded with wizards </li></ul></ul><ul><ul><li>Reports, forms and charts </li></ul></ul><ul><ul><li>Connect pages using branches </li></ul></ul><ul><ul><li>75 pre-defined widgets </li></ul></ul><ul><ul><li>Basic HTML, pop-up lists, calendars, etc. </li></ul></ul><ul><ul><li>Full data entry validation </li></ul></ul>
    11. 11. More Features <ul><li>Session and State Management </li></ul><ul><ul><li>Each user has a session </li></ul></ul><ul><ul><li>Valid username/password is required </li></ul></ul><ul><li>User Interface Control </li></ul><ul><ul><li>Look-and-feel is separate from application logic </li></ul></ul><ul><ul><li>Extensive templates </li></ul></ul><ul><li>Flexible Authentication and Authorization Schemes </li></ul><ul><ul><li>Can use pre-built / built-in methods or custom </li></ul></ul>
    12. 12. “ Installing” APEX <ul><li>Apply for a free account at </li></ul><ul><ul><li>Set up other developers / users for testing </li></ul></ul><ul><li>Can optionally download and install locally </li></ul><ul><ul><li>Run the script on your 9iR2 or better database (also need Apache listener) </li></ul></ul><ul><ul><li>Down / Upload your applications to your home system </li></ul></ul><ul><ul><li>Continue development on your home system </li></ul></ul><ul><li>Oracle 10g Companion CD </li></ul><ul><li>Oracle Express Edition </li></ul><ul><li>Develop your application (read the Help messages – they really do help!) </li></ul><ul><li>Excellent support via OTN discussion forum </li></ul>
    13. 13. Architecture Browser Oracle Database APEX Oracle HTTP Server
    14. 14. Architecture B Browser Oracle Database APEX Oracle HTTP Server Firewall Instead of the Oracle HTTP Server, you can use the HTTP Server supplied with Oracle Application Server 9i or 10g
    15. 15. APEX Uses Who, What, When, Where, Why…
    16. 16. What can you do with APEX? <ul><li>Select Journal Article review system (developed in 2 weeks) </li></ul><ul><li>Web Collaboration application (developed in 2 days) </li></ul><ul><li>General purpose Customer Survey (developed in 1 day) </li></ul><ul><li>Survey Administration screens (developed in 2 hours) </li></ul>
    17. 17. Select Journal Article review
    18. 18. Web Collaboration application
    19. 19. Customer Survey
    20. 20. Survey Administration
    21. 21. Testing Application
    22. 22. Creating an APEX Application Generally speaking
    23. 23. Log into Workspace <ul><li>Use the Workspace you chose, the username and password emailed to you </li></ul>
    24. 24. Home Menu <ul><li>You’re ready to begin </li></ul><ul><ul><li>Build Applications </li></ul></ul><ul><ul><li>Work in SQL </li></ul></ul><ul><ul><li>Work with Data </li></ul></ul><ul><ul><li>Manage users </li></ul></ul>
    25. 25. Migrate Data <ul><li>Import data from Spreadsheets, XML or Delimited Files </li></ul>
    26. 26. Load Northwinds? <ul><li>I loaded the Northwinds Database from SQL Server </li></ul><ul><li>Used Periscope to load/copy data </li></ul><ul><li>Once loaded, view data using SQL Workshop </li></ul>
    27. 27. Drill and Create <ul><li>Can </li></ul><ul><ul><li>Drill into data </li></ul></ul><ul><ul><li>Count rows </li></ul></ul><ul><ul><li>Insert/Edit rows </li></ul></ul><ul><ul><li>Query by Example </li></ul></ul><ul><ul><li>View components </li></ul></ul><ul><ul><li>Much more… </li></ul></ul>
    28. 28. Use the Wizards <ul><li>APEX’s many wizards will simplify your life – use them! </li></ul><ul><li>Reports, Charts, Forms, Calendars, Trees, etc. </li></ul>
    29. 29. Create a Hardware Inventory Application
    30. 30. Building an application “from scratch” – in 5 simple steps <ul><li>Login with developer privileges </li></ul><ul><li>Use the SQL tools to make your tables, constraints, triggers, procedures etc. </li></ul><ul><li>Start a new application (use the wizard) </li></ul><ul><li>Customize the application (check each change as you make it) </li></ul><ul><li>Deploy to the users! </li></ul>
    31. 31. Example Hardware Inventory App <ul><li>Record and view hardware inventory </li></ul><ul><li>Searchable report </li></ul><ul><li>Present analysis graphically as well as numerically </li></ul><ul><li>Design for novice users </li></ul><ul><li>Remote users with access to Internet </li></ul>
    32. 32. Main Menu
    33. 33. Import Data (SQL Workshop)
    34. 34. Converting Data <ul><li>Previously, data was stored in an Excel spreadsheet </li></ul><ul><li>Conveniently, this can be made into an Oracle table by simply copying and pasting into the APEX create table wizard </li></ul><ul><li>Select Region </li></ul><ul><li>Copy from Excel </li></ul>
    35. 35. Import Data Wizard
    36. 36. Paste Your Data In…
    37. 37. Set Column Preferences
    38. 38. Create a Primary Key and sequence
    39. 39. Object Detail for Table Created (in Object Browser)
    40. 40. Create Lookup Table <ul><li>Select column for look up </li></ul><ul><li>Specify lookup table specifics </li></ul>
    41. 41. Create an Application
    42. 42. Create the application form scratch (this time)
    43. 43. Add Report and Form based on Hardware table <ul><li>Notice inclusion of Analysis pages </li></ul>
    44. 44. Specify Details for Analysis
    45. 45. Could add as many pages as you want
    46. 46. Select Levels of Tabs
    47. 47. Can Share Components for other applications
    48. 48. Specify Security and Language
    49. 49. Choose a Theme
    50. 50. Verify and Finish
    51. 51. Run your new Application! (you will need to log in)
    52. 52. Instant Application! <ul><li>Searchable report </li></ul><ul><li>Links to edit individual rows </li></ul>
    53. 53. Instant Application! <ul><li>Edit form with </li></ul><ul><ul><li>Calendar widget </li></ul></ul><ul><ul><li>Picklist based off lookup table </li></ul></ul>
    54. 54. Instant Application! <ul><li>Analysis Chart and Report </li></ul>
    55. 55. Good start but improvements can be made <ul><li>Makes “codes” more meaningful </li></ul><ul><li>Format output </li></ul><ul><li>Edit page through edit link </li></ul>
    56. 56. Three basic areas for each page
    57. 57. Elements of a Page <ul><li>Shared Components </li></ul><ul><ul><li>Tabs </li></ul></ul><ul><ul><li>Navigation bar </li></ul></ul><ul><ul><li>Templates </li></ul></ul><ul><li>Regions </li></ul><ul><ul><li>Items </li></ul></ul><ul><ul><li>Labels </li></ul></ul><ul><ul><li>Buttons </li></ul></ul><ul><ul><li>Widgets </li></ul></ul>
    58. 58. Most things are created through WIZARDS <ul><li>Step by step </li></ul><ul><li>Collect essential info </li></ul>
    59. 59. EVERYTHING has attributes and almost everything has an edit page All of the basic attributes collected through the wizards, and many more detailed attributes are editable through an elements attribute/edit page. All of this information is called Meta Data.
    60. 60. Attribute/Edit Pages <ul><li>Attributes in regions by logical groups </li></ul><ul><li>Quick navigation to each region </li></ul><ul><li>Many items are select lists </li></ul><ul><li>Almost all have context sensitive help </li></ul>
    61. 61. Reuse of Shared Components LOV used for both report and edit
    62. 62. Easy Data Validation <ul><li>Some validation created automatically based on database. </li></ul><ul><li>Others easily created with wizard. </li></ul>
    63. 63. Validation Wizard <ul><li>Choose the item </li></ul><ul><li>Specify the validation type </li></ul>
    64. 64. Validation Wizard <ul><li>Choose subtype </li></ul><ul><li>Specify sequence and where error message is to be displayed </li></ul>
    65. 65. Validation Wizard <ul><li>Depending on method, provide validation details </li></ul><ul><li>Specify error message </li></ul><ul><li>Always look for help provided </li></ul><ul><ul><li>Examples </li></ul></ul><ul><ul><li>Item lookups </li></ul></ul>
    66. 66. MOST things can be CONDITIONAL! <ul><li>Many, many different types of conditions available. </li></ul><ul><li>Item is displayed or processed depending on the outcome of the condition. </li></ul>
    67. 67. Validation <ul><li>Message displayed by item, central location or both </li></ul><ul><li>Navigation not allowed until validations pass </li></ul>
    68. 68. Security <ul><li>Two levels </li></ul><ul><ul><li>Authentication, controls initial access to the application </li></ul></ul><ul><ul><li>Authorization, can control access to tabs, pages, regions, items, buttons, read/write vs read only, ….. </li></ul></ul><ul><li>Use APEX built in functionality, totally custom or somewhere in between. </li></ul>
    69. 69. Make a backup!
    70. 70. Save the export
    71. 71. Deployment Process Development Production Data HTML DB App PL/SQL Code (Periodic Refresh)
    72. 72. APEX Administration <ul><li>Administrator controls Workspaces </li></ul><ul><li>Workspaces control developer access and provide resources. </li></ul>
    73. 73. APEX Administration <ul><li>Workspaces can be requested. </li></ul><ul><li>Workspaces are “provisioned” </li></ul><ul><li>Initial users are created, more can be created by the “workspace” administrator </li></ul><ul><li>Workspaces/Applications can be monitored. </li></ul>
    74. 74. Workspace Administration <ul><li>Workspace administrator manages services </li></ul><ul><li>Creates and alters workspace / application users </li></ul><ul><li>Monitors Activity </li></ul>
    75. 75. Workspace Administration Many reports and charts are available to monitor workspace activity. Many application reports are also available (to developers also)
    76. 76. APEX Tips and Techniques
    77. 77. Sample Applications <ul><li>The Sample Applications have great examples </li></ul><ul><li>Take some time to understand the applications </li></ul><ul><li>Standard Sample – Common Concepts </li></ul>
    78. 78. More Examples <ul><li>Collections Showcase – Shopping cart concepts </li></ul><ul><li>Web Services </li></ul><ul><li>Presidential Inaugural Addresses – Oracle Text Examples </li></ul>
    79. 79. Spend Time on Analysis/Design <ul><li>Time Well Spent </li></ul><ul><ul><li>Follows standard design principals </li></ul></ul><ul><ul><li>Storyboard approach makes it a visual process </li></ul></ul><ul><li>Pay me now or pay me more later… </li></ul><ul><ul><li>Poor design, results in a poor application </li></ul></ul><ul><ul><ul><li>Important to understand Web development to design </li></ul></ul></ul>
    80. 80. Storyboard Design <ul><li>Take the time to map our your tabs, menus, layout and design </li></ul>Home Page Products Consulting Training A… B… C... Products Consulting Training
    81. 81. Debugging <ul><li>To view the current value of any object (if you’re a developer), you can click on the session button at any time </li></ul>
    82. 82. Help! <ul><li>The online help that is available is very well written as a reference </li></ul><ul><li>The OTN Discussion Forum is very helpful! </li></ul>
    83. 83. Web Services <ul><li>Web Services provide you the power of running a process on someone else’s machine as if it’s on your own machine </li></ul>
    84. 84. Creating a Popup <ul><li>You can specify a TARGET=NEW for an href if you want the URL / Link to pop up a new page when clicked </li></ul><ul><li>This is useful when referencing other sites </li></ul>
    85. 85. “ Report” on Page <ul><li>If you wish to execute a query and return the results to page region that you create, rather than using a PL/SQL block, use a “Report.” </li></ul>
    86. 86. Adding Images <ul><li>To add images, static HTML / Docs and CSS files to the application, click on </li></ul><ul><ul><li>Shared Components </li></ul></ul><ul><ul><ul><li>Images </li></ul></ul></ul><ul><ul><ul><li>CSS </li></ul></ul></ul><ul><ul><ul><li>Static Files </li></ul></ul></ul>
    87. 87. Beware! <ul><li>Bugs do exist in APEX </li></ul><ul><li>Be careful about changing things once they are created </li></ul><ul><ul><li>Changing “Types” </li></ul></ul><ul><ul><li>Changing Item Names </li></ul></ul>
    88. 88. Advanced Topics <ul><li>Debugging </li></ul><ul><li>Using Collections </li></ul><ul><li>Authentication & Authorization </li></ul><ul><li>Administration </li></ul><ul><li>Deployment Process </li></ul><ul><li>Available Functions & APIs </li></ul><ul><li>Monitoring Activity </li></ul>
    89. 89. Debugging <ul><li>Run any page in your application </li></ul><ul><li>Turn on debug mode by clicking on Debug in the developer toolbar </li></ul><ul><li>Timing is processor time, not rendering time </li></ul><ul><li>Append &p_trace=YES to your URL to generate SQL Trace File </li></ul>
    90. 90. Using Collections <ul><li>Enable you to temporarily capture rows and columns of data </li></ul><ul><li>Data is persistent throughout a users unique session </li></ul><ul><li>Examples of when to use a collection: </li></ul><ul><ul><li>A wizard with more than one page </li></ul></ul><ul><ul><li>A shopping cart application </li></ul></ul>
    91. 91. Controlling Collections <ul><li>HTMLDB_COLLECTION API </li></ul><ul><ul><li>Create </li></ul></ul><ul><ul><li>Delete </li></ul></ul><ul><ul><li>Truncate </li></ul></ul><ul><ul><li>Add/Update/Delete Members </li></ul></ul><ul><ul><li>Check Status </li></ul></ul><ul><ul><li>Merging </li></ul></ul><ul><ul><li>Managing </li></ul></ul>
    92. 92. Authentication & Authorization <ul><li>Establish User Identity Through Authentication </li></ul><ul><li>Provide Security Through Authorization </li></ul>
    93. 93. Authentication <ul><li>HTML DB will assign the authenticated username to the built-in substitution string :APP_USER </li></ul><ul><li>Several Schemes </li></ul><ul><ul><li>No Authentication/DAD </li></ul></ul><ul><ul><li>LDAP </li></ul></ul><ul><ul><li>OracleAS SSO (App as a Partner App) </li></ul></ul><ul><ul><li>OracleAS SSO (HTLM DB as Partner App) </li></ul></ul><ul><ul><li>HTML DB Internal </li></ul></ul><ul><ul><li>Open Door </li></ul></ul><ul><ul><li>Custom </li></ul></ul>
    94. 94. Authorization <ul><li>Once a user is Authenticated, Authorization Schemes control what that user can/cannot see & do </li></ul><ul><li>Several Scheme Types </li></ul><ul><ul><li>Exists or NOT Exists SQL Query </li></ul></ul><ul><ul><li>Item is NULL or NOT NULL </li></ul></ul><ul><ul><li>PL/SQL Function </li></ul></ul><ul><ul><li>Value of Item = or != Specified Value </li></ul></ul>
    95. 95. Administration <ul><li>An HTML DB Administrator’s main task is to manage the instance of HTML DB </li></ul><ul><li>Monitor Activity to ensure good performance </li></ul><ul><li>Some common tasks include </li></ul><ul><ul><li>Approving Service & Change Requests </li></ul></ul><ul><ul><li>Managing Schema to Workspace Mappings </li></ul></ul><ul><ul><li>Managing Schemas & Tablespaces </li></ul></ul><ul><ul><li>All Other Associated DBA functions </li></ul></ul>
    96. 96. Available Functions & APIs <ul><li>Four major APIs </li></ul><ul><ul><li>HTMLDB_UTIL </li></ul></ul><ul><ul><li>HTMLDB_ITEM </li></ul></ul><ul><ul><li>HTMLDB_APPLICATION </li></ul></ul><ul><ul><li>HTMLDB_CUSTOM_AUTH </li></ul></ul>
    97. 97. APEX Summary <ul><li>For additional information, check out: </li></ul><ul><ul><li> </li></ul></ul><ul><li>Externally Hosted Instance </li></ul><ul><ul><ul><li>OTN Discussion Forums </li></ul></ul></ul><ul><ul><ul><li>HTML DB “How To” Documents </li></ul></ul></ul>
    98. 98. Reference Materials
    99. 99. Referencing Items <ul><li>Substitution String </li></ul><ul><ul><li>#variableName# </li></ul></ul><ul><li>Short Substitution String </li></ul><ul><ul><li>&variableName </li></ul></ul><ul><li>PL/SQL </li></ul><ul><ul><li>v(‘variableName’) </li></ul></ul><ul><ul><li>nv(‘numericValue’) </li></ul></ul><ul><li>Bind Variable </li></ul><ul><ul><li>:variableName </li></ul></ul><ul><li>Items can be used to: </li></ul><ul><ul><li>Include a substitution string within a template </li></ul></ul><ul><ul><li>Create an item at the application or page level </li></ul></ul><ul><ul><li>Use built-in substitution strings to achieve a specific type of functionality </li></ul></ul>
    100. 100. &variableName. <ul><li>&variableName is used when you need to substitute a variable as when you are building a link to another page </li></ul><ul><li>You often need to place a period at the end of the name </li></ul><ul><li>For example: </li></ul><ul><ul><li>f?p=&app_id.:2:&session </li></ul></ul>
    101. 101. #variableName# <ul><li>#variableName# is similar to &variableName. but is used in templates and as a parameter in SQL statements </li></ul>
    102. 102. :variableName <ul><li>:variableName represents a bind variable and can be used in SQL Query and PL/SQL regions </li></ul><ul><li>For example: </li></ul><ul><ul><li>SELECT project_title, total_cost </li></ul></ul><ul><ul><li>FROM projects </li></ul></ul><ul><ul><li>WHERE project_id = :P1_project_id </li></ul></ul>
    103. 103. v(‘variableName’) <ul><li>v('variableName') or nv(‘numericVariableName') are functions from the HTML DB APIs that can be used in PL/SQL or SQL statement where a function is called </li></ul><ul><li>For example: </li></ul><ul><ul><li>htp.anchor('f?p=' || :app_id || ':2:' || v('SESSION'), 'An HTML DB Link') ; </li></ul></ul>
    104. 104. Implicit Variables <ul><li>APP_SESSION </li></ul><ul><li>APP_USER </li></ul><ul><li>IMAGE_PREFIX </li></ul><ul><li>WORKSPACE_IMAGES </li></ul><ul><li>APP_IMAGES </li></ul><ul><li>BROWSER_LANGUAGE </li></ul><ul><li>PRINTER_FRIENDLY </li></ul><ul><li>HOME_LINK </li></ul><ul><li>PROXY SERVER </li></ul><ul><li>REQUEST </li></ul><ul><li>SYSDATE_YYYYMMDD </li></ul><ul><li>DEBUG </li></ul><ul><li>APP_ID </li></ul><ul><li>APP_PAGE_ID </li></ul><ul><li>APP SCHEMA OWNER </li></ul><ul><li>SQLERRM </li></ul><ul><li>AUTHENTICATED_URL_PREFIX </li></ul><ul><li>LOGOUT_URL </li></ul><ul><li>PUBLIC_URL_PREFIX </li></ul><ul><li>CURRENT_PARENT_TAB_TEXT </li></ul><ul><li>APP_ALIAS </li></ul><ul><li>APP_UNIQUE_PAGE_ID </li></ul>
    105. 105. f?p Syntax <ul><li>f=function, that handles it all </li></ul><ul><li>p=parameters, separated by a colon </li></ul><ul><li>f?p=16654:104 </li></ul><ul><ul><li>1) Application Number (16654, &APP_ID.) </li></ul></ul><ul><ul><li>2) Page Number (104) </li></ul></ul><ul><ul><li>3) Session (&SESSION.) </li></ul></ul><ul><ul><li>4) Request </li></ul></ul><ul><ul><li>5) Debug </li></ul></ul><ul><ul><li>6) Clear Cache (RP resets pagination) </li></ul></ul><ul><ul><li>7) Item Names, comma separated </li></ul></ul><ul><ul><li>8) Item Values, comma separated </li></ul></ul><ul><ul><li>9) Printer Friendly </li></ul></ul><ul><li>For blank parameters, just include the colon with nothing between </li></ul>
    106. 106. Summary <ul><li>Powerful </li></ul><ul><li>Relatively Easy </li></ul><ul><li>Fast </li></ul><ul><li>Secure </li></ul><ul><li>Really works </li></ul><ul><li>Hosted </li></ul>TUSC’s Vision Passionate about the Technology Best in the World Economic engine Oracle
    107. 107. Questions and Answers
    108. 108. <ul><li> </li></ul><ul><li> </li></ul><ul><li> </li></ul><ul><li> </li></ul><ul><li> </li></ul><ul><li>Oracle Press, “Oracle HTML DB Handbook” by Lawrence C Linnemeyer and Bradley D. Brown </li></ul>Where to Get More Information
    109. 109. <ul><li>Thank you to Brad Brown, the other team members of TUSC for their contributions to this presentation. </li></ul><ul><li>Please report errors to TUSC. Neither TUSC, or the author warrant that this document is error-free. </li></ul><ul><li>TUSC © 2006. This document may not be copied or reproduced without the express written consent of TUSC. </li></ul>Special Thanks To…