Oracle and JSP Server

Download Report

Transcript Oracle and JSP Server

JSP Server Integrated with
Oracle8i
Project2, CMSC691X
Summer02
Ching-li Peng
Ying Zhang
Outline
Introduction
Servlet and JSP
Oracle and JDBC
Project
Goal
Installation of JSP server
Installation of Oracle8i
Servlet
 Read explicit data sent by client (form data)
 Read implicit data sent by client (request
headers)
 Generate the results
 Send the explicit data back to client (HTML)
 Send the implicit data to client (status codes
and response headers)
JSP
 Java Server Pages (JSPs)
 Use regular HTML for most of the page
 Mark dynamic content with special tags
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN">
<HTML>
<HEAD><TITLE>Welcome to Our Store</TITLE></HEAD>
<BODY>
<H1>Welcome to Our Store</H1>
<SMALL>Welcome,
<!-- User name is "New User" for first-time visitors
-->
<%= Utils.getUserNameFromCookie(request) %>
To access your account settings, click
<A HREF="Account-Settings.html">here.</A></SMALL>
<P>
Regular HTML for rest of on-line store’s Web page
</BODY></HTML>
Oracle
 Client/Server
 Large databases
 Support concurrent accesses from a large
number of users
 High transaction processing performance
 High availability
 Openness, industry standards
 Manageable security
 Distributed system
JDBC
 Java Database Connectivity
 A standard or open application programming
interface (API) for accessing a database from
JAVA programs.
 Allow Java to run and process SQL
Select, Update, Insert, Delete, and …
 Oracle JDBC Thin driver
Use Java socket to connect directly to Oracle
Provide its own implementation of a TCP/IP version of
Oracle’s Net8
Project Goal
 Install
Linux: Redhat7.2
JSP server: Tomcat3.3
Database: Oracle8i (8.1.7)
 Write a test servlet
Retrieve the data from database and show the result on
client’s browser
JSP Server: Tomcat
 Installation
 Download Tomcat3.3
 Unzip it
 Make sure the path includes the JDK bin
directory.
 Update the CLASSPATH to include
 install_dir\lib\servlet.jar
 install_dir\lib\jasper.jar
 Problems
 NONE!
 What we learned
 TOMCAT is great!
Oracle8i
Pre-Installation
Create group dba and oinstall
Create user oracle and add it to these two
groups
Make sure jdk1.1.8_v3 is installed under
/usr/local
Create installation directory, /u01, with
ownership of oracle
Login in as oracle and modify the
.bash_profile file under its home
directory(/home/oracle)
Oracle8i (Cont.)
 Installation
Download oracle8.1.7 and unzip it
Run the universal installer, runinstaller.sh
Follow the instructions on the screen to finish the
installation of Oracle Enterprise Edition
 Problems
The installation files are actually buggy
Oracle9i requires large memory and disk space
 What we learned
Installing Oracle8i on Redhat7.2 is reasonably tough
Test Servlet
Function
Establish network connection to Oracle via
JDBC driver
Retrieve all the records of table Employ in
Oracle 8.1.7
Show the retrieved data from Oracle in a HTML
table in user’s browser