K Wassily Kandinsky - Composition IV, 1911. Web Publishing using PL/SQL and Java Eric Grancher CERN (Geneva), IT/DB European Organization.

Slides:



Advertisements
Similar presentations
4 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: Servlets.
Advertisements

 2002 Prentice Hall. All rights reserved. Chapter 9: Servlets Outline 9.1 Introduction 9.2 Servlet Overview and Architecture Interface Servlet and.
An architecture for webb applications, J2EE
Objectives Ch. D - 1 At the end of this chapter students will: Know the general architecture and purpose of servlets Understand how to create a basic servlet.
Servlets and a little bit of Web Services Russell Beale.
WEB1P servintro1 Introduction to servlets and JSP Dr Jim Briggs.
An introduction to Java Servlet Programming
18-Jun-15 JSP Java Server Pages Reference: Tutorial/Servlet-Tutorial-JSP.html.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 34 Servlets.
JSP Java Server Pages Reference:
2/16/2004 Dynamic Content February 16, /16/2004 Assignments Due – Message of the Day Part 1 Due – Reading and Warmup Work on Message of the Day.
Introduction to Servlet & JSP
Java database Programming JDBC Trademarked name of a Java API that supports Java programs that access relational databases Stand for Java DataBase Connectivity.
Java Server and Servlet CS616 Team 9 Kim Doyle, Susan Kroha, Arunima Palchowdhury, Wei Xu.
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.
Chapter 4 Servlets Concept of Servlets (What, Why, and How) Servlet API Third-party tools to run servlets Examples of Using Servlets HTML tag with GET.
Servlets Compiled by Dr. Billy B. L. Lim. Servlets Servlets are Java programs which are invoked to service client requests on a Web server. Servlets extend.
Servlets. Our Project 3-tier application Develop our own multi-threaded server Socket level communication.
Java Servlets. What Are Servlets? Basically, a java program that runs on the server Basically, a java program that runs on the server Creates dynamic.
Servlet and JSP Programming: An Introduction Spiros Papadimitriou
Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg.
Introduction Servlets and JSP Celsina Bignoli
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
Chapter 4: Core Web Technologies
Servlets. - Java technology for Common Gateway Interface (CGI) programming. - It is a Java class that dynamically extends the function of a web server.
Objectives Java Servlet Web Components
JSP Java Server Pages Softsmith Infotech.
Java support for WWW Babak Esfandiari (sources: Qusay Mahmoud, Roger Impey, textbook)
Li Tak Sing COMPS311F. Static attributes in Servlets Since Servlets are also Java classes, you can also use static attributes to store values that can.
111 Java Servlets Dynamic Web Pages (Program Files) Servlets versus Java Server Pages Implementing Servlets Example: F15 Warranty Registration Tomcat Configuration.
Chapter 7 Java Server Pages. Objectives Explain how the separation of concerns principle applies to JSP Describe the operation and life-cycle of a JSP.
COMP 321 Week 7. Overview HTML and HTTP Basics Dynamic Web Content ServletsMVC Tomcat in Eclipse Demonstration Lab 7-1 Introduction.
Standalone Java Application vs. Java Web Application
CMPUT 391 – Database Management Systems Department of Computing Science University of Alberta CMPUT 391 Database Management Systems Web based Applications,
Web Server Programming 1. Nuts and Bolts. Premises of Course Provides general introduction, no in-depth training Assumes some HTML knowledge Assumes some.
Introduction to ColdFusion Yu Fu 2003 MEC Candidate.
JAVA SERVER PAGES CREATING DYNAMIC WEB PAGES USING JAVA James Faeldon CS 119 Enterprise Systems Programming.
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.
Java Servlets & Java Server Pages Lecture July 2013.
® IBM Software Group © 2007 IBM Corporation Best Practices for Session Management
20-Nov-15introServlets.ppt Intro to servlets. 20-Nov-15introServlets.ppt typical web page – source Hello Hello.
Servlets Part 3. Topics Session Tracking ServletToServletCommunication-Servlet Chaining ServerSideIncludes AppletToServlet.
Java Servlets and Java Server Pages Norman White Stern School of Business.
Copyright © 2002 ProsoftTraining. All rights reserved. Java Servlets.
1 Java Servlets l Servlets : programs that run within the context of a server, analogous to applets that run within the context of a browser. l Used to.
Middleware 3/29/2001 Kang, Seungwoo Lee, Jinwon. Description of Topics 1. CGI, Servlets, JSPs 2. Sessions/Cookies 3. Database Connection(JDBC, Connection.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, Responds oriented other.
1 Introduction to Servlets. Topics Web Applications and the Java Server. HTTP protocol. Servlets 2.
JS (Java Servlets). Internet evolution [1] The internet Internet started of as a static content dispersal and delivery mechanism, where files residing.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 21 Java Servlets Wed. 11/22/00 based on material.
Java Servlets and Java Server Pages
HTTP protocol Java Servlets. HTTP protocol Web system communicates with end-user via HTTP protocol HTTP protocol methods: GET, POST, HEAD, PUT, OPTIONS,
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
Update from Oracle OpenWorld, November 15th-18th 1999, Los Angeles Eric Grancher IT/DB.
Bayu Priyambadha, S.Kom. Static content  Web Server delivers contents of a file (html) 1. Browser sends request to Web Server 3. Web Server sends HTML.
CS 562 Advanced Java and Internet Application Computer Warehouse Web Application By Team Alpha :-  Puja Mehta (102163)  Mona Nagpure (102147)
Enterprise Java v050228MVC1 Model, View, Controller Web Architecture.
Speaker Name Speaker Title Speaker Title Oracle Corporation Olivier Le Diouris Principal Product Manager Oracle Corporation Building Servlet and JSP Applications.
Introduction to Servlets
Introduction Servlets and JSP
WWW and HTTP King Fahd University of Petroleum & Minerals
Servlet Fudamentals.
Java Servlets By: Tejashri Udavant..
Pre-assessment Questions
Introduction to J2EE Architecture
Chapter 26 Servlets.
Objectives In this lesson you will learn about: Need for servlets
Introduction to Java Servlets
Java Chapter 7 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

K Wassily Kandinsky - Composition IV, 1911

Web Publishing using PL/SQL and Java Eric Grancher CERN (Geneva), IT/DB European Organization for Nuclear Research EOUG 2000, paper 60

Plan About server side web applications, not to conclude Java (or PL/SQL) is better…  Introduction (what technology, where is it used ?)  Special features  Security features and pitfalls  Transaction handling  Manageability  Performance  Suggestions and Conclusion

The PL/SQL “cartridge”  The original method, since 1995  Has proven to be fast, reliable  Embraced a lot in the Oracle “community”, including CERN  Has almost not changed a lot for 5 years (transactions, file upload…)  Used  In Oracle Application Server  In WebDB  As the target for Designer Web generation

How the PL/SQL cartridge works  Based on Oracle PL/SQL stored objects  Few simple PL/SQL packages, the PL/SQL Web toolkit  OAS makes the mapping between the URL and the database account  Procedure is executed, it fills up a buffer, returns it and commits browser OAS /app1/plsql/pa.pr?l_a1_num=3 Net8 HTTP execute pa.pr(l_a1_num=>3); owa.get_page; commit; PACKAGE PA IS PROCEDURE PR(l_a1_num NUMBER); END; PL/SQL table …

PL/SQL example procedure t1 (p_a1_num number default 100) is cursor c is select t1,t2 from t where rownum < p_a1_num; begin htp.print(' '); htp.htmlopen; htp.headopen; htp.title(p_a1_num); htp.headclose; htp.bodyopen; for c1 in c loop htp.print(c1.t1||'--'||c1.t2); end loop; htp.bodyclose; htp.htmlclose; end; arguments specify DOCTYPE loop around the cursor

The Java techniques  Java introduced by Sun, object orientation, no pointer arithmetic, compilation into an OS neutral VM  Java2 Enterprise Edition, Java Servlet and Java Server Pages  Used in  “All” web servers, Oracle Application Server  Oracle iFS  The RDBMS itself (8.1.7)

How the Java techniques work  Server side Java execution  Java Server Pages and SQLJ are all “transformed” into plain Java code with JDBC access to the database, we will concentrate on Servlets  Java class writes to a stream that is sent back to the browser  Init, service/doGet/doPost and destroy “main” methods browser /app1/java/TestServlet HTTP HTML JDBC www listener & JVM

Standard Java Servlet code public class BasicServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = new PrintWriter (response.getOutputStream()); out.println(" "); out.println(" Title "); out.println(" some text in the body"); out.println(" "); out.flush(); } } arguments and output set MIME & get out send page to out

Java code with Oracle extensions public class BasicOracle extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ ServletOutputStream out_str=response.getOutputStream(); out_str.println("Content-type: text/html"); out_str.println(); HtmlHead head = new HtmlHead("Title !"); HtmlBody body = new HtmlBody(); HtmlPage page = new HtmlPage(head, body); body.addItem(new SimpleItem("Some body text")); page.print(out_str); out_str.flush(); } } arguments and output set MIME & get out send page to out create page

Special features  Non HTML  Specify a non “ text/html ” mime-type like CSV = application/msexcel  Return “raw” data  Return XML data, to be handled by a local XSL preprocessor or used in another program  (Java only)  Non textual: images…  Networking access: , ftp…  LDAP access  Servlet chaining  External or remote processing (Enterprise Java Beans)

Security  Encryption, use of SSL at the listener level. With OAS4, no possibility to restrict access to an application to a set of TCP ports !  Access control  Before or within the application (simplicity vs. extensibility)  Source of users  configuration file  LDAP  Oracle users for the PL/SQL cartridge (WebDB 2.x)  Custom run-time protection with the PL/SQL cartridge (authorize function)  Pitfall with small vs. capital letters (PL/SQL cartridge)  good practice is to protect everything and “unprotect” the few URLs to be made more widely available /app1/plsql/private* = Basic(admin)/app1/plsql/ = Basic(admin) /app1/plsql/public* = IP(allip) /app1/plsql/priVate.admin !!!

Transaction and session handling  One of the biggest issues for a dynamic site: transaction, locking and contexts (session and application)  HTTP is basically stateless  one has to workaround  Solutions for context, inter web page communication  Hidden fields  Cookies  Servlet-only: place variables in the context  Application context  Session context (uses URL rewriting or cookies) HttpSession session = request.getSession (true); Integer ItemCount = (Integer) session.getValue("itemcount"); if (ItemCount == null) { ItemCount=new Integer (0); } else { ItemCount = new Integer(ItemCount.intValue()+1); } session.putValue("itemcount",ItemCount); get session reference retrieve the value put the value

Transactions  Pseudo locking can be implemented with the help of PL/SQL owa_opt_lock  Real transactions  PL/SQL can make use of declarative URLs with the transaction service, no control on the transaction, easy to setup but some issues with the session handling  JDBC/Java Transaction Service, programmatic approach, more code, more control Distributed Transaction Coordinator Application Instance

Manageability  Packaging systems  Packages in PL/SQL  Object Orientation, packages with Java  Coding conventions  Sun “Code Conventions”  PL/SQL reference books  N accounts architecture (data, API, logic, presentation…)  N tier architecture, for Java applications, place the Java logic in EJB  PL/SQL dependencies  make calls to PL/SQL stored procedures from Java

Performance  As usual, database design and SQL are the most common sources of the bottlenecks !  Use parameterized statements, avoid dynamic SQL  Java  place as much as possible in the init/destroy  Java  manage a connection pool, see JDBC 2.0  Java  use StringBuffer or the oracle.html classes  This is done by the PL/SQL cartridge “for free”

Performance tests MethodResponseThroughput PL/SQLreference J1 = DB connection within code + 776%- 23 % J2 = DB connection within init/destroy + 8%- 8% J3 = J2 using Oracle packages + 20 %- 394 % J4 = J2 using StringBuffer + 16 %- 24 % J5 = J2 using a PreparedStatement + 20 %+ 7%, size(code)=4* Relative times. Sun E450, RDBMS 8.1.6, OAS connections at the same time

Mixing technologies  Basic idea: “Avoid to use many different technologies, it makes more complex applications”… at least do it in a N tier architecture  Java as the presentation layer (JSP, Servlets) + database access in PL/SQL  Benefits of new features (session and application contexts, TCP connection like , binary types…)  PL/SQL dependencies  PL/SQL as the presentation layer + Java stored procedures to extend PL/SQL ( , TCP connections, specific functions…)  Easy management of code, simpler code  New features via the Java calls

Conclusions ?  Java techniques provide very interesting features (session context…), they still evolve very fast, Java2 EE, JDBC 2.0.  No need to rush on Servlets/Java Server Pages, PL/SQL programming is most of the time simpler, needs less tuning and is very well integrated with the database.  Servlet in the database  will help to have highly- performing, centrally maintained Java code. Some issues are opened, will you open your DB server through the firewall ?  Mixing Java and PL/SQL (dependencies) can be a solution. Keep access to database objects with PL/SQL.