Web Programming with PL/SQL Erdogan Dogdu Georgia State University Computer Science Department

Slides:



Advertisements
Similar presentations
Analytic Functions : An Oracle Developer’s Best Friend
Advertisements

Oracle 10g & 11g for Dev Virtual Columns DML error logging
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 9 Using Perl for CGI Programming.
Web forms and CGI scripts Dr. Andrew C.R. Martin
Displaying Data from Multiple Tables. Objectives After completing this lesson, you should Be able to do the following: Write SELECT statements to accessWrite.
Brief History of OA Framework How did OA Framework Evolve Why did OA Framework Evolve Why is it still evolving Changes in Fusion.
UFCE8V-20-3 Information Systems Development 3 (SHAPE HK) Lecture 3 PHP (2) : Functions, User Defined Functions & Environment Variables.
Copyright  Oracle Corporation, All rights reserved. 3 Displaying Data from Multiple Tables.
Presenter: James Huang Date: Sept. 29,  HTTP and WWW  Bottle Web Framework  Request Routing  Sending Static Files  Handling HTML  HTTP Errors.
HTTP Request/Response Process 1.Enter URL ( in your browser’s address bar. 2.Your browser uses DNS to look up IP address of server.com.
TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 22 World Wide Web and HTTP.
1.  Understanding about How to Working with Server Side Scripting using PHP Framework (CodeIgniter) 2.
12-1 Copyright  Oracle Corporation, All rights reserved. What Is a View? EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
PART 6 Application Layer
PL/SQL Server Pages (Web Programming with PL/SQL)
World Wide Web1 Applications World Wide Web. 2 Introduction What is hypertext model? Use of hypertext in World Wide Web (WWW) – HTML. WWW client-server.
Multiple Tiers in Action
Introduction to Web Interface Technology (CSE2030)
JSP Architecture  JSP is a simple text file consisting of HTML or XML content along with JSP elements  JSP packages define the interface for the compiled.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
Chapter 9 Using Perl for CGI Programming. Computation is required to support sophisticated web applications Computation can be done by the server or the.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
1 HTML and CGI Scripting CSC8304 – Computing Environments for Bioinformatics - Lecture 10.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
CSE 190: Internet E-Commerce Lecture 5. Exam Material Lectures 1-4 (Presentation Tier) –3-tier architecture –HTML –Style sheets –Javascript –DOM –HTTP.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
School of Computing and Information Systems CS 371 Web Application Programming PHP – Forms, Cookies, Sessions and Database.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
Chapter 3 Servlet Basics. 1.Recall the Servlet Role 2.Basic Servlet Structure 3.A simple servlet that generates plain text 4.A servlet that generates.
Dr. Philip Cannata 1 Programming Languages Prolog Part 3 SQL & Prolog.
Website Development with PHP and MySQL Saving Data.
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Introduction to Relational Databases &
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Cursors These slides are licensed under.
PSP Oracle Application Server. Configurations Database Access Descriptor (DAD) –Username: scott –Password: tiger –Connect String: localhost:1521:orc Create.
Mainframe (Host) - Communications - User Interface - Business Logic - DBMS - Operating System - Storage (DB Files) Terminal (Display/Keyboard) Terminal.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
Perl CGI What is "CGI"? Common Gateway Interface A means of running an executable program via the Web. Perl have a *very* nice interface to create CGI.
CS 4720 Dynamic Web Applications CS 4720 – Web & Mobile Systems.
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Implementing The Middle Tier These slides.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
Copyright  Oracle Corporation, All rights reserved. 12 Creating Views.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
©SoftMooreSlide 1 Introduction to HTML: Forms ©SoftMooreSlide 2 Forms Forms provide a simple mechanism for collecting user data and submitting it to.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
Oracle CONNECT BY function JAVA WEB Programming. Emp 테이블의 내용 ( 상 / 하급자 계층구조 ) SQL> select * from emp; EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
Copyright س Oracle Corporation, All rights reserved. 12 Creating Views.
COSC 2328 – Web Programming.  PHP is a server scripting language  It’s widely-used and free  It’s an alternative to Microsoft’s ASP and Ruby  PHP.
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
1 Chapter 22 World Wide Web (HTTP) Chapter 22 World Wide Web (HTTP) Mi-Jung Choi Dept. of Computer Science and Engineering
5 Copyright © 2004, Oracle. All rights reserved. PL/SQL Server Pages.
World Wide Web has been created to share the text document across the world. In static web pages the requesting user has no ability to interact with the.
Internet/Web Databases
Computing with C# and the .NET Framework
Introduction to Dynamic Web Programming
WWW and HTTP King Fahd University of Petroleum & Minerals
Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
CASE STUDY -HTML,URLs,HTTP
PHP / MySQL Introduction
What Is a View? EMPNO ENAME JOB EMP Table EMPVU10 View
Chapter 27 WWW and HTTP.
PART 6 Application Layer
Presentation transcript:

Web Programming with PL/SQL Erdogan Dogdu Georgia State University Computer Science Department

CSC8711 Content Oracle Architecture for Web Apps Oracle mod_plsql Apache module HTTP A Simple PL/SQL Web Toolkit Example PL/SQL Web Toolkit Parameter Passing HTML Forms PL/SQL Server Pages

CSC8711 Oracle Web Extensions 3-tier: client, application server (OAS 9i), database (Oracle 9i) mod_plsql in OAS PL/SQL Web Toolkit

CSC8711 Web Request Processing 1. The Oracle HTTP Server receives a PL/SQL Server Page request from a client browser. 2. The Oracle HTTP Server routes the request to mod_plsql. 3. The request is forwarded by mod_plsql to the Oracle Database. By using the configuration information stored in your DAD, mod_plsql connects to the database.

CSC8711 Web Request Processing (cont.) 4. Mod_plsql prepares the call parameters, and invokes the PL/SQL procedure in the application. 5. The PL/SQL procedure generates an HTML page using data and the PL/SQL Web Toolkit accessed from the database. 6. The response is returned to mod_plsql. 7. The Oracle HTTP Server sends the response to the client browser.

CSC8711 Invoking mod_plsql protocol://hostname[:port]/DAD location/[[!][schema.][package.]proc_ name[?query_string]] Example: –

CSC8711 HTTP GET, POST, HEAD methods GET. Parameters in query string. POST. For large parameter data. – POST data="a=v&b=1“ HEAD. No content data is streamed back. Only a confirmation.

CSC8711 A Simple Example Write a PL/SQL procedure (simple.sql) using PL/SQL Web Toolkit: CREATE OR REPLACE PROCEDURE simple AS l_user varchar2(30); BEGIN select USER into l_user from dual; htp.htmlOpen; htp.headOpen; htp.title('A Very Very Simple Example'); htp.headClose; htp.bodyOpen; htp.line; htp.header(1,'Simple Example'); htp.line; htp.paragraph; …

CSC8711 A Simple Example (cont.) … htp.print('Today''s date is: ' || to_char(sysdate, 'DD/MM/YYYY')); htp.br; htp.print('Today''s day is: ' || to_char(sysdate, 'DAY')); htp.paragraph; htp.print('Ordinary tags can be used in the strings that we send.'); htp.print('Your Oracle USERID is ' || l_user); htp.line; htp.address('Raj Sunderraman'); -- owa_util.signature('orarbkx.simple'); htp.bodyClose; htp.htmlClose; EXCEPTION When others Then htp.print(SQLERRM); htp.bodyClose; htp.htmlClose; END; / show errors

CSC8711 A Simple Example (cont.) Upload the procedure ‘simple’ to the database: > sqlplus Procedure created. No errors. Run procedure:

CSC8711 Web Toolkit Oracle Web Toolkit includes a number of packages: htp and htf package: hypertext procedures and functions, owa_cookie: to handle HTTP cookies, owa_util: utility subprograms, etc.

CSC8711 htp package Example: create or replace procedure hello AS BEGIN htp.htmlopen; -- generates htp.headopen; -- generates htp.title('Hello'); -- generates Hello htp.headclose; -- generates htp.bodyopen; -- generates htp.header(1, 'Hello'); -- generates Hello htp.bodyclose; -- generates htp.htmlclose; -- generates END;

CSC8711 htp and htf package More htp functions: –Comment: htp.comment –Applet: htp.appletopen, … –List: htp.olistOpen, htp.ulinstOpen, … –Form: htp.formOpen, … –Table: htp.tableOpen, htp.tableData, … –Image: htp.img, etc. –Formatting: htp.print, htp.bold, htp.underline, … –Frame: htp.frame, …

CSC8711 owa_util owa_util.tablePrint create or replace procedure showemps is ignore_more boolean; begin ignore_more := owa_util.tablePrint('emp', 'BORDER', OWA_UTIL.PRE_ TABLE); end; This procedure gives the output (next slide)

CSC8711 owa_util | EMPNO |ENAME |JOB |MGR |HIREDATE | SAL | COMM | DEPTNO | | 7369| SMITH | CLERK | 7902 | 17-DEC-80 | 800 | | 20 | | 7499| ALLEN | SALESMAN| 7698 | 20-FEB-81 | 1600 | 300 | 30 | | 7521| WARD | SALESMAN| 7698 | 22-FEB-81 | 1250 | 500 | 30 | | 7566| JONES | MANAGER | 7839 | 02-APR-81 | 2975 | | 20 | | 7654| MARTIN | SALESMAN| 7698 | 28-SEP-81 | 1250 | 1400| 30 | | 7698| BLAKE | MANAGER | 7839 | 01-MAY-81 | 2850 | | 30 | | 7900| JAMES | CLERK | 7698 | 03-DEC-81 | 950 | | 30 | | 7902| FORD | ANALYST | 7566 | 03-DEC-81 | 3000 | | 20 | | 7934| MILLER | CLERK | 7782 | 23-JAN-82 | 1300 | | 10 |

CSC8711 Passing Parameters GET method create or replace procedure pl1(str in varchar2, num in number) as begin for i in 1..num loop htp.print(i || '. ' || str); htp.br; end loop; end; 1. Hello 2. Hello 3. Hello 4. Hello

CSC8711 HTML Forms htp.formOpen(curl in varchar2, cmethod in varchar2 default ‘POST’, ctarget in varchar2, cenctype in varchar2 default null, cattributes in varchar2 default null);

CSC8711 HTML Forms htp.formSubmit(cname in varchar2 default null, cvalue in varchar2 default ‘Submit’, cattributes in varchar2 default null)

CSC8711 HTML Forms HTML forms can have the following elements: –Single line input text (htp.formText) –Single line input password (htp.formPassword) –Checkboxes (htp.formCheckbox) –Radio buttons (htp.formRadio) –Submit buttons (htp.formSubmit) –Text areas (htp.formTextarea) –Selects (htp.formSelectOpen, htp.formSelectOption, htp.formSelectClose)

CSC8711 HTML Forms Useful functions: owa_util.get_owa_service_path: Returns the prefix of the URL pointing to PL/SQL procedure Example: Use in PL/SQL web program as: htp.formOpen(owa_util.get_owa_service_ path || ‘start_session’);

CSC8711 Disadvantages of Web Toolkit PL/SQL Web Toolkit (htp, htf) generates HTML code form PL/SQL programs. Generating nice web pages is difficult, you cannot author PL/SQL programs in Frontpage. Solution is PSP (next)

CSC8711 PL/SQL Server Pages (PSP) Author web pages using script-friendly HTML authoring tools. Drop in PL/SQL code in web pages. In short: –Web Toolkit: generate HTML from PL/SQL –PSP: embedded PL/SQL within HTML

CSC8711 PL/SQL Server Pages (PSP) Same script tag syntax as JSP, also similar to ASP PSP files should have.psp extension Can be as simple as an HTML page (no PL/SQL script) Specifying the scripting language

CSC8711 PL/SQL Server Pages (PSP) Parameter passing Returned document type Such as text/xml, text/plain, image/jpeg Stored procedure name

CSC8711 PL/SQL Server Pages (PSP) Loading psp document to Oracle loadpsp [ -replace ] -user [ include_file_name... ] [ error_file_name ] psp_file_name...