0% found this document useful (0 votes)
16 views11 pages

PL/SQL Web Toolkit Overview Guide

This document provides an overview and introduction to using the PL/SQL Web Toolkit for developing web applications. It describes the components needed, including the Oracle database, Oracle HTTP Server, and mod_plsql. It demonstrates basic HTML tags and structures that can be generated using the HTP package. It provides an example of building a simple data entry application with procedures for display, processing, and validation. It also lists some commonly used packages for generating HTML, cookies, images, and other elements in a web application.

Uploaded by

faqp
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views11 pages

PL/SQL Web Toolkit Overview Guide

This document provides an overview and introduction to using the PL/SQL Web Toolkit for developing web applications. It describes the components needed, including the Oracle database, Oracle HTTP Server, and mod_plsql. It demonstrates basic HTML tags and structures that can be generated using the HTP package. It provides an example of building a simple data entry application with procedures for display, processing, and validation. It also lists some commonly used packages for generating HTML, cookies, images, and other elements in a web application.

Uploaded by

faqp
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PL/SQL Internet Programming

John P. Jeunnette Prairie Systems Group, Limited

Learning Objectives
Describe the PL/SQL Web Toolkit Describe a Web Toolkit application Demonstrate Web Toolkit application development

Speakers Qualifications
John Jeunnette is a Principal Consultant at Prairie Systems Group, Limited. Twenty-plus years of Oracle-based application development. First Web Toolkit application for a major aerospace firm in 1998. Active in multiple user groups: President of the Oracle Development Tools User Group, member of the Rocky Mountain Oracle Users Group. Occasional speaker on PL/SQL programming and the Web Toolkit.

Agenda
The Internet and how it works HTML Basics PL/SQL Web Toolkit How to use the PL/SQL Web Toolkit Questions

The Internet
HyperText Transport Protocol (HTTP)
TCP/IP (Transmission Control Protocol/Internet Protocol) Request/Response Stateless

The Internet
HyperText Markup Language (HTML)
Tagging schema based on Standard Generalized Markup Language (SGML) Separate content from format Minimal content identification

The Internet
Browsers
Netscape Navigator Microsoft Internet Explorer Mozilla Firefox (open source) Safari (Macs) Opera

Variations
Javascript implementations User Interface

The Internet (summary)


HTML HTTP (TCP/IP) Web Browser

The Internet
Uniform Resource Locators (URLs)
Resolve to a specific IP address via a Domain Name Server lookup [Link] [Link] pls/caat/caat_abstracts_upd.main?co nference_id=17

Browsers/HTML
Document Object Model (DOM)
Web Page contents/organization Document = <html></html> as organized by a browser

HTML Basics
<html> <head> protocol header data (optional) </head> <body> Page contents </body> </html>

HTML Basics: Tables


<table> <tr> <td>cell contents</td> <td>another cell</td> </tr> <tr> <td>a cell in another row</td> <td>another row</td> </tr> </table>

HTML Basics: Links


<a href=[Link] [Link]/pls/caat/caat_abstract s_upd.add_abstract?conference_i d=17>Add an Abstract</a>

HTML Basics: Forms


<FORM action=/pls/caat/caat_abstracts_upd.valid ate_abstract method=POST name=abstract> Name: <INPUT TYPE="text" NAME=abstract_name" SIZE=100" MAXLENGTH=50"> <INPUT <INPUT TYPE=submit> </FORM> POST verses GET parameters

PL/SQL Web Toolkit


Some History (from Tom Kyte)
Web Oracle Web (WOW Gateway) by Magnus Lonnroth of Sweden. Oracle Web Agent (OWA) in version 1 of the Oracle Internet Server. Cartridge in the Oracle Web Server (version 2) OWAREPL by Tom Kyte in the Oracle Web Application Server (OWAS version 3). Webdb listener Oracle Application Server (version 4) includes PL/SQL cartridge

mod_plsql for Apache (Oracle HTTP Server).

PL/SQL Web Toolkit


Components:
Oracle Database 8.1.6 and later Oracle HTTP Server (OHS) (Apache) Mod_plsql Data Access Descriptor(s)

Oracle Express Edition Embedded Gateway XML DB Embedded Gateway

Components Overview

B R O W S E R
(Javascript)

HTTP

A P A C H E

M O D _ P L S Q L

D A D

SQL*Net

O R A C L E
(ht%, Owa Packages)

PL/SQL Web Toolkit


Context:
CGI Scripts ASP Active Server Pages .NET dot Net JSP Java Server Pages (and descendents) PHP PHP: Hypertext Preprocessor PSP PL/SQL Server Pages Ruby on Rails

PL/SQL Web Toolkit


Pros:
Completely in the database Familiar syntax Stateless

Cons:
Stateless No separation of HTML from the code

PL/SQL Web Toolkit


Data Access Descriptor (10g):
PlsqlDatabaseUsername PlsqlDefaultPage PlsqlDocumentPath PlsqlDocumentProcedure PlsqlDocumentTablename PlsqlErrorStyle PlsqlMaxRequestsPerSession PlsqlSessionStateManagement

PL/SQL Web Toolkit


Application Demonstration

PL/SQL Web Toolkit Documentation


Oracle Application Server PL/SQL Web Toolkit Reference, 10g Release 3 (10.1.3). Part number B25598 Oracle Application Server mod_plsql Users Guide, 10g Release 3 (10.1.3). Part number B25599 HTML Javascript (optional)

PL/SQL Web Toolkit


HelloWorld simple procedure example
CREATE OR REPLACE PROCEDURE HelloWorld AS BEGIN [Link]; [Link]; [Link]( Hello Seriously Practical folks ); [Link]; [Link]; END;

PL/SQL Web Toolkit


Application Module Logic
Block mode Implicit database commits Procedure independence (stateless) Optimistic locking No returns The browser controls appearance Lots of code Procedure parameters (names and data types) Exception blocks (error processing/debugging)

PL/SQL Web Toolkit


Application Module Flow
Parameter entry or record selection criteria Record collection screen with add, modify, and delete links One record data entry form Submit to a validation routine If validation errors, redisplay the data entry form for correction. If no errors, insert or update the record.

PL/SQL Web Toolkit


Application Development
Storyboarding:

PL/SQL Web Toolkit


Data entry application example: OPP_contacts_upd package display_contacts procedure process_contact procedure validate_contact procedure Table: opp_contacts contact_id integer primary key, contact_name varchar2(100), contact_type varchar2(20), contact_email varchar2(200), contact_comments clob

PL/SQL Web Toolkit


HTP package procedures that generate HTML tags. HTP package function versions of the procedures in the HTP package. (They return the tagged text so they can be embedded in other calls.) Owa_cookie Subprograms that send and receive HTTP cookies to and from a client Web browser. Owa_image Subprograms that obtain the coordinates where a user clicked an image. (Use with image maps.) Owa_opt_lock Subprograms that impose database optimistic locking strategies, to prevent lost updates. Owa_pattern Subprograms that perform string matching and string manipulation with regular expression functionality. Owa_sec Subprograms used by the PL/SQL Gateway for authenticating requests. Owa_text Subprograms used by package OWA_PATTERN for manipulating strings. Owa_util Utility subprograms. Wpg_download Subprograms that download documents from a document repository that you define using the DAD configuration.

PL/SQL Web Toolkit


Basic page structure: [Link] [Link] [Link] [Link] [Link] [Link] [Link] [Link] [Link] [Link] [Link] [Link] [Link] [Link] [Link] or [Link] [Link] [Link] [Link]

PL/SQL Web Toolkit Tables


[Link] [Link] [Link] [Link] [Link] [Link] [Link] [Link] [Link] [Link]

10

PL/SQL Web Toolkit


Observations
Web PL/SQL Toolkit applications behave like block mode terminals. Stateless operation can be confusing: the application (or the user) can navigate horizontally within the application to unexpected places. Let the browser format the pages Implicit commits are good and bad.

PL/SQL Web Toolkit


Thank you Contact:
JohnJeunnette@[Link]

A Real World User Group


[Link]

For Real World Developers

11

Common questions

Powered by AI

The PL/SQL Web Toolkit offers the advantage of operating completely within the database, utilizing familiar PL/SQL syntax, and being stateless. However, it also has significant drawbacks, such as a lack of separation between HTML and the PL/SQL code, which can complicate maintenance and updates. The stateless nature of the toolkit can lead to difficulties in maintaining the application's state across requests .

The PL/SQL Web Toolkit generates HTML content using PL/SQL procedures such as htp.htopen and htp.print. This approach tightly couples HTML generation with business logic, which can make code less maintainable and more challenging to separate the design and logic, complicating updates and modifications to either aspect .

'Stateless' in the context of PL/SQL Web Toolkit applications means that each HTTP request from the client is independent and does not retain any user session information on the server side. This affects application design by necessitating mechanisms to manage state externally, such as leveraging client-side cookies, URL rewriting, or server-side session management techniques .

The PL/SQL Web Toolkit allows user interface customization primarily through PL/SQL packages like htp, enabling custom HTML generation. However, challenges arise due to its stateless architecture, which can lead to complex navigation issues. Moreover, the lack of separation between logic and presentation complicates design changes, restricting flexibility .

mod_plsql acts as a bridge between the Apache HTTP Server (Oracle HTTP Server) and the Oracle Database, allowing PL/SQL code to be executed in response to web requests. Key components include the Oracle Database version 8.1.6 or later, Apache server, and the Data Access Descriptor (DAD), which defines database connection details and PL/SQL procedures to execute .

The Document Object Model (DOM) is crucial in web development as it represents the structure and organization of a web page in a tree-like format, allowing browsers to render and manipulate HTML documents. It defines how the document is accessed and manipulated using scripting languages like JavaScript .

Data Access Descriptors (DAD) in the PL/SQL Web Toolkit define the configuration for database connections required by the application. They specify details such as database username, default page, and document paths, ensuring that web applications can retrieve and update data via the Oracle database appropriately .

To create a 'Hello World' application using the PL/SQL Web Toolkit, you define a PL/SQL procedure such as 'HelloWorld'. This procedure would use the htp package to generate HTML, opening and closing tags (htop.htmlOpen, htp.bodyOpen/Close, etc.), and employ the htp.print method to output 'Hello World' to the browser .

The Owa_cookie package in the PL/SQL Web Toolkit provides subprograms to send and receive HTTP cookies between the web server and client browsers. This package is essential for maintaining user session data across page requests, enabling mechanisms like authentication and personalized content delivery .

The PL/SQL Web Toolkit uses exception blocks to manage error processing and debugging within its applications. These blocks handle unexpected situations by capturing and responding to exceptions, which is crucial for robust web application development. The toolkit's integration of these exception blocks ensures that errors do not propagate unduly to the end users, maintaining usability and stability .

You might also like