• Tidak ada hasil yang ditemukan

Appendix

Dalam dokumen Fără titlu. (Halaman 34-52)

(From Oracle Documentation) Using Oracle Universal Installer

Oracle Universal Installer automatically installs the Java Runtime Environment (JRE). The JRE is a subset of the Java Developer Kit (JDK). To run Java applications, JRE is required. To develop Java applications, JDK is required.

Non-Interactive Insta IIation

Typically, Oracle Universal Installer can be run in interactive mode. However, installer in non-interactive or silent mode is available for advanced users (such as database administrators), by using a response file. This is a text file containing vai-iables and values used by Oracle Universal Installer during the installation process. Using the silent installation enables to bypass the graphical user interface (GUI) and install Oracle products in silent mode.

To use a response file, response file should be modified and it is located in the \Response folder located at the root of the Oracle8ij9i Enterprise Edition CD-ROM. Accompanying readme.txt file can be seen for more information.

Running the Installation

The following steps describe a Typical, interactive installation of Oracle8ij9i Enterprise Edition for Windows NT. Users, choosing a Minimal or Custom installation may encounter a slightly different set of windows.

To install a Typical installation of Oracle8ij9i Enterprise Edition for Windows NT:

29

.,. Operating system should be started. If Windows NT 4.0 is running, logging to Windows NT server as a member of the Administrators group is required

r All Oracle services should be stopped (if any are running).

For Windows NT 4.0, services can be stopped as follows:

From the Control Panel, services icon can be selected.

If any Oracle services (names begin with Oracle) exist and have the status Started, it should be stopped

.,. OracleSi Enterprise Edition CD-ROM should be inserted into CD-ROM drive. The Autorun page automatically appears. If the Autorun page does not appear, Start > Programs>

Windows NT Explorer should be chosen. The Windows NT Explorer will start

r Navigation to the root directory of the CD-ROM is needed.

SETUP.EXE should be double-clicked. The welcome screen for Oracle Universal Installer will appear and installation will begin

;,.. Selection must be made when prompted by the OracieSi Enterprise Edition -Autorun dialog box:

Add/Remove Products Explore CD

Browse

.,. Selecting Add/Remove Products will begin the installation process. The Welcome window will appear

,. Clicking Next is required. The File Locations window will appear. Source ... field must not be changed

,. Oracle Home name and directory location is required to install OracleSi/9i Enterprise Edition components. The default

appear Space location is <drive with the most available space> :\ORACLE\ORASI or \ORACLE\ORA9I

:,...Clicking Next will proceed. The Available Products window will appear

,. Oracle product should be selected to install (default is OracleSij9i Enterprise Edition)

:,...Clicking Next will proceed. The Installation Types window will appear. Appropriate installation type is required (Typical, Minimal, or Custom)

,. Clicking Next will proceed. The Location for Oracle Documentation window will appear for a Typical or Custom installation. Hard Drive selection to install the documentation will install documentation on the hard drive. Otherwise, documentation will remain on the CD-ROM

:,...Clicking Next will proceed. At this point of the installation, prompt to upgrade database with the Oracle Data Migration Assistant may appear (if Oracle Universal Installer detects an earlier version of an Oracle database on hard drive). Selecting the Migrate an Existing Database check box will make Oracle Data Migration Assistant start immediately after installation to migrate existing database. Click Next. The Database Identification window appears

,. Global Database Name and SID in the fields provided are required

:,...Clicking Next will proceed. The Summary window will listing the Global Settings, Product Languages, Requirements, and New Installations

,. Install should be clicked. After the components are installed, the Configuration Tools window will appear and NetS

31

Configuration Assistant and other appropriate assistants will automatically start in succession. The Configuration Tools window will display the results of running these assistants :.- Clicking Next will proceed. The End of Installation window will

appear.

:.- Clicking Exit is needed to exit from Oracle Universal Installer or clicking Next is needed to install another product.

(From Jakarta Tomcat Documentation) Installing Tomcat

This section deals with installing the Tomcat binary archive available from the Jakarta Project. It is also possible to install Tomcat by building it from source, but that isn't covered here. Downloading of the appropriate jakarta-tomcat-<version> binary archive file is necessary. For Linux, RPMs are also available.

Archive should be expanded into some directory (say /usr/local or C:\). This should create a new subdirectory named "jakarta-tomcat-

<version>". Renaming this directory is also possible. Instructions to use the new name should be followed. For Linux, RPMs may be installed with the command "rpm -Uvh". Command man rpm will give more information.

Environment Setup

There are a number of different methods to start and stop Tomcat. There are differences in the environmental setup needed for these methods. This section addresses the environmental setup needed for using the shell scripts and batch files provided to simplify starting and stopping Tomcat. This section assumes manual starting and stopping of Tomcat from a shell or MS-DOS window.

Setting the environment variable JAVA_HOME is required to point to the root directory of your JDK hierarchy. Optional addition of the Java interpreter to PATH environment variable is possible. The exact directory may vary from system to system. Checking of local file system should be done to be sure where Java is installed.

Win32:

JAVA_HOME=c:/jdk1.3.1

PATH=%JAVA_HOME% \bin; %PATH%

Unix (bash/sh):

JAVA_HOME=/usr/localjjava/jdkl.3.1;

export JAVA_HOME

PATH=$JAVA_HOME/bin: $PATH;

export PATH

Unix (tcsh):

JAVA_HOME=/usr/localjjava/jdkl.3.1 PATH $JAVA_HOME/bin:$PATH

TOMCAT_HOME environment variable is optional. If the supplied shell/batch scripts are executed from "jakarta-tomcat-<vers;on>" or from its "bin" subdirectory, then they will successfully set TOMCAT_HOME if not already set. If these shell/batch scripts needed to be executed from other directories, setting TOMCAT_HOME is mandatory.

33

On Win32 systems:

TOMCAT_HOME=c: \jakarta-tomcat- <version>

On UNIX (using bash/sh):

TOMCAT_HOME=/usr/local/jakarta-tomcat- <version>;

TOMCAT_HOME

On UNIX (using tcsh):

TOMCAT_HOME /usr/local/jakarta-tomcat-<version

>

Starting Tomcat

After opening a shell or MS-DOS window and setting the environment as described in the prior section, starting and stopping of Tomcat can be done.

Tomcat can be started:

On Win32: bin\startup On UNIX: bin/startup.sh

This will start Tomcat in the background on Unix based systems, or in a new MS-DOS window on Windows based systems. A short period of time is needed before Tomcat is ready to serve requests. The very first use will need a little extra time since some WAR files will be expanded by default.

Whether Tomcat has completed can be verified by its startup, when text like the following appears in the log output.

2001-09-01 14:23:30 - Http10Interceptor: Starting on 8080 2001-09-01 14:23:30 - Ajp12Interceptor: Starting on 8007 2001-09-01 14:23:30 - Ajp13Interceptor: Starting on 8009

In Tomcat's default configuration, Tomcat's output log is not assigned to a file. Instead, Tomcat's log output goes stderr. On

Windows systems, switching to the MS-DOS window can be done to see if this test has appeared.

The default Tomcat configuration will service HTTP requests on port 8080. Starting browser with http://localhost:8080/ will present Tomcat's Welcome page.

In addition to serving HTTP, the default configuration will service Ajp12 protocol requests on port 8007 and Ajp13 protocol requests on 8009. These protocols are used by the "connectors" which allow Tomcat to be used as a Servletj]SP container for an external web server, such as Apache. Also, the Ajp12 protocol is used by the Tomcat shutdown process.

Options and system property settings can be passed to the Java VM by specifying them in an environment variable called TOMCAT_OPTS (for instance: '-server' is useful as a performance

enhancement if running Sun's HotSpot VM).

Note: On Win9x, it's not possible to include system property settings in TOMCAT_OPTS because the SET command won't accept a line with more than one equals sign.

The "auto-generated" configuration files for external web servers, such as Apache, are not written during a normal startup of Tomcat. To write the configuration files, append jkconf to the startup command. Tomcat will initialize sufficiently to write the files and then exit. This may be done while the Tomcat is running as a web server.

Stopping Tomcat

To perform a normal shutdown of Tomcat, a special "shutdown"

request must be send from a separate process, or possibly a different computer. In the default configuration, that "shutdown" request must be made using the Ajp12 protocol. If the shell or MS-DOS window used

35

to start Tomcat is not still open, opening a new one is essential and environment should be set as same as for starting Tomcat.

Tomcat can be stopped:

On UNIX: bin/shutdown.sh On Win32: bin\shutdown

The shutdown process incorporates a host, port, and a password. In the default configuration, the host defaults to localhost.

This means that Tomcat can only be shutdown from the same computer that started it. The port automatically defaults to the port being used by the Ajp12 protocol. The password defaults to "not specified". This means that a password will not be required to shutdown Tomcat:

Developed Software

Some frequently occurred problems and their solutions are given below

Ql. Tomcat cannot be started, what can be done?

Ans. Oracle's TNSListener should be stopped, Tomcat should be started (TNSListener should be started again).

Q2. Required html pages can not be found, what can be done?

Ans. Stepl> Given URL should be checked, if URL is ok step 2 should be followed else it must be fixed.

Step2> With http://Iocalhost:8080/ uri, if Tomcat's starting page comes, Step 4 should be followed else Step 3.

Step3> If Tomcat is not running, Starting Tomcat Section in the appendix section can be seen.

Step4> Web folder, context mapping and servlet registration should be checked for errors.

Q3. Invalid argument call error has shown, what should be done?

Ans. This problem can be solved by filling imperative text boxes.

Q4.How network adapter connection problem can be solved?

Ans. Oracle TnsListener should be started.

Q5. How connection refusal problem can be solved?

Ans. Database should be mounted and opened ..

37

Q6. Invalid username and password error, how to eliminate?

Ans. Spelling should be checked, if it doesn't work database administrator should be consulted.

Q7. Deletion of any data without giving Student ID or Question Number is possible, why?

Ans. No actual row will be deleted from the tables.

Q8. Data can not be inserted or modified, why?

Ans. All mandatory text boxes needed to be filled.

Q9. While there are question in tables it shows no question is available, how to solve?

Ans. Due to connection problem it may happen, moving one pages back and then returning will solve the problem

Ql0. How number of questions per pages can be changed after starting the examination

Ans. Once examination is started this option can not be changed.

Ql1. Table's can not be created, why?

Ans. Old tables with the same name should be deleted (All old information will be erased)

Q12. What will happen, if database objects are created in different schemas.

Ans. Username and password used in Module - 4 Source Codes should be changed. Otherwise students will not be able to connect.

Module 1

Codes necessary for creating database tables.

table.html

<HTML>

<HEAD>

<TITLE >LOGIN </TITLE> </HEAD >

< BODY>< FORMACTION= http://localhost :SOSO/Sohebl/servlet/ AuthenCheck METHOD=POST>

<H3>Please enter login name and identification number.</H3><BR>

<PRE>

Name: <INPUT TYPE=text NAME=Name>

ID: <INPUT TYPE=text NAME=ID>

</PRE>

<INPUT TYPE=SUBMIT value=Submit>

<INPUT TYPE=reset>

</FORM>

</BODY>

</HTML>

Authencheck.java

import java.sql. *;

import javax.swing.*;

import oracle.sql. *;

import java.io. *;

import javax.servlet. *;

import javax.servlet.http. *;

import java.util.*;

import oracle.jdbc.driver. *;

import java.math.*;

//AuthenCheck will check for valid user in the database public class AuthenCheck extends HttpServlet

{

Cannection conn;

Statement stmt;

ResultSet rset;

public void init(ServletConfig config) throws ServletException {

super.init( config);

)

public void doPost(HttpServletRequest req,HttpServletResponse res) throws IOException

{

int i=O,exams;

PrintWriter output;

/ /Tname for holding Teacher Name and Tid for holding Teacher ID String Tname='''',Tid='''';

Tname= req.getPara meter("'Name");

if(Tname==null) Tname=Tname+"@";

Tid = req .getParameter("ID");

if(Tid==null) Tid=Tid+"@";

String stl,st2;

boolean identification=false;

try {

DriverManager. registerDriver (new oracle.jdbc.driver.OracleDriverO);

conn =

DriverManager.getConnection ("jdbc: oracle :thin:@netvista103: 1521: soh9i 1",Tname, Tid);

stmt = conn.createStatement

0;

rset = stmt.executeQuery ("select D.

*

from dual D");

identification =true;

}

catch(Exception sqlex) {

output= res.getWriter();

res.setContentType( "text/html");

output.println(" <H2 >Check following errors</H2>");

output. println (sqlex);

output.closeO;

}

if (identification) {

Cookie c1=new Cookie("Tname",Tname);

c1.setMaxAge( -10);

Cookie c2=new Cookie("Tid",Tid);

c2.setMaxAge( -10);

res.addCookie(c1) ; res.addCookie(c2) ; output= res.getWriterO;

res.setContentType( "text/html");

String Buffer buf=new StringBuffer();

buf.append(" < HTML>< HEAD><TITLE>");

buf.append("Table Creation Page");

buf.append (" </TITLE> </HEAD> < BODY>");

buf.append(" < FORMACTION= http://netvista 103: 8080/Sohebl/servlet/CreateTable METHOD=POST>");

buf.append("<BR>"+"<H3>Please Enter Course ID (String)</H3>");

buf.append("<INPUT TYPE=text NAME=courseid>"+"<BR>");

buf.append("<BR>"+"<H3>Please Enter Number of Examinations(Integer)</H3>");

buf.append(" <INPUT TYPE=text NAME=examno>"+" <BR><BR>");

buf.append(" <INPUT TYPE=Submit Vaiue=Submit>"+"<BR>");

buf.append(" </FORM> </BODY> </HTM L>");

output. println( buf.toString());

output.c1ose() ; }

}

public void destroy() {

try {

conn .close();

}catch(Exception e) {System.err.println("Problem closing the database");}

} }

CreateTable.java

import java.sql. *;

import javax.swing. *;

import oracle.sql.*;

import java.io. *;

import javax.servlet. *;

import javax.servlet.http. *;

import java.util. *;

import oracle.jdbc.driver. *;

import java.math. *;

//CreateTable will creates necessary tables in the database under teacher schema public class CreateTable extends HttpServlet

{

Connection conn;

Statement stmt;

ResultSet rset;

public void init(ServletConfig config) throws ServletException {

super.init( config);

}

public void doPost(HttpServletRequest req,HttpServletResponse res) throws IOException

{

PrintWriter output;

Cookie cookies[]=null;

cookies= req .getCookies();

/ / Retrieving Teacher Name and ID from cookies

String Tna me= "" ,Tid = "" ,course= null,examno_string =null;

int examno=O,exam=O;

course= req .getParameter("courseid");

examno_string = req .getParameter("examno");

if (cookies' =null) {

for (int i=O;i<cookies.length;i++) {

Cookie cookie = null;

cookie=cookies[i] ;

if( (cookie.getName()) .equals("Tname")) Tname=cookie.getValue();

if( (cookie.getName()) .equals("Tid")) Tid =cookie.getValue();

} } try {

examno= Integer. parseInt( examno_string);

}catch(NumberFormatException e) {

output= res.getWriter();

outpuLprintin("<H2 >Check following errors soheb</H2>");

output. println( e);

res.setContentType("text/html") ; String Buffer buf= new StringBuffer();

buf.a ppend(" < HTML> < HEAD> <TITLE>");

buf.append("Table Creation Page");

buf.a ppend(" </TITLE> </HEAD> < BODY>");

buf.append(" < FORMACTION= http://netvista 103 :8080/Soheb l/servlet/ AuthenCheck METHOD=POST>");

buf.append("<INPUT TYPE=HIDDEN NAME=ID VALUE="+ Tid+" >");

buf.append("<INPUT TYPE=HIDDEN NAME=Name VALUE="+ Tname+">");

buf.append(" <BR><INPUT TYPE=Submit Value= Back>"+"<BR>");

buf.append("' </FORM ></BODY> </HTML>");

output. println( buf. toString(»;

output.close() ; }

try {

DriverManager .reg isterDriver(new oracle.jdbc.d river.OracleDriver(»;

conn =

DriverManager.getConnection("jdbc: oracle :thin:@netvistal03: 1521 :soh9i 1", Tname, Tid);

stmt = conn.createStatement ();

I I Creating Teacher Table rset = stmt.executeQuery

("CREATE TABLE Teacher(ID VARCHAR2(15) CONSTRAINT Teacher_Prim PRIMARY KEY,Exams NUMBER(4) )");

rseLclose() ;stmLclose();

stmt = conn.createStatement ();

II Inserting Course Name and No. of Examinations in the Teacher Table rset = stmLexecuteQuery("INSERT INTO Teacher

VALUES(''' +course+ '" ," +examno+")");

rset.close() ;stmt.close();

stmt = conn .createStatement();

rset = stmt.executeQuery ("'Select T.

*

from Teacher T");

while (rset.next()) {

exam=rset.getlnt(2) ; }

rset.close() ;stmt.close();

stmt = conn.createStatement();

IICreating Examl, Exam2, ,Examn Tables

for (int i=O;i<exam;i++) {

String name="Exam";

name=name+(i+ 1);

rset = stmt.executeQuery

("CREATE TABLE "+name+" (No Number(4) CONSTRAINT Unique_Number"+i+"

UNIQUE CONSTRAINT NotNull_Number"+i+" NOT Null,Quest VARCHAR2(200),Ansl VARCHAR2( 50) ,Ans2 VARCHAR2( 50) ,Ans3 VARCHAR2( 50) ,Ans4

VARCHAR2(50),Correct VARCHAR2(5»)");

}

rset.c1ose() ;stmLclose();

stmt = conn.createStatement();

rset = stmLexecuteQuery ("Select T.

*

from Teacher T");

while (rset.next()) {

exam=rset.getlnt(2) ; }

rset.c1ose() ;stmt.close();

stmt = conn.createStatement();

((Creating Student Table rset = stmt.executeQuery

("CREATETABLE Student(ID VARCHAR2(15) CONSTRAINT Student]rim PRIMARY KEY,Name VARCHAR2(30) CONSTRAINTStudenCName NOT NULL)");

rset.close() ;stmLclose();

stmt = conn.createStatement();

for (int i=O;i<exam;i++) {

String name="Exam";

name=name+ (i+ 1);

rset = stmt.executeQuery

("ALTER TABLE Student ADD ("+name+" NUMBER(4))");

}

conn.c1ose() ;

output= res.getWriter();

res.setContentType("text(html") ;

output. println(" <H2> Tables Created«H2 >");

outpuLclose() ;

}catch(Exception sqlex) {

output= res.getWriter();

output.println(" <H2 >Check following errors«H2 >");

output. println(sqlex);

res.setContentType("text(html") ; String Buffer buf=new StringBuffer();

buf.append (" <HTML> < HEAD> <TITLE>");

buf.append("Table Creation Page");

buf.append(" «TITLE> «HEAD> < BODY>");

buf.append(" < FORMACTION= http:((netvista103:8080(Sohebl(servlet(AuthenCheck METHOD=POST>");

buf.append("<INPUT TYPE=HIDDEN NAME=ID VALUE="+ Tid+">");

buf.append("<INPUT TYPE=HIDDEN NAME=Name VALUE="+Tname+">");

buf.append(" <BR><INPUT TYPE=Submit Value=Back>"+"<BR>");

buf.a ppend(" </FORM > </BODY> </HTML>");

output. println( buf.toString(»;

output.close() ; }

}

public void destroy() {

try {

conn .close();

}catch(Exception e) {System.err.println("Problem closing the database");}

} }

7

Module 2

Codes necessary for inserting and manipulating students information in Student table

student.html

<HTMl>

<HEAD>

<TITLE >lOGIN </TiTlE > </H EAD>

< BODY><FORM ACTION= http://localhost: 8080/Sohebl/servlet/ AuthenCheckl METHOD=POST>

<H3>Please enter login name and identification number.</H3><BR>

<PRE>

Name: <INPUT TYPE=text NAME=Name>

ID: <INPUT TYPE=text NAME=ID>

</PRE>

<INPUT TYPE=SUBMIT value=Submit>

<INPUT TYPE=reset>

</FORM>

</BODY>

</HTMl>

Dalam dokumen Fără titlu. (Halaman 34-52)

Dokumen terkait