Installing the Oracle9i XML Employee Information Application

Table of Contents

Required Software

Back To Top
  • Oracle9i Database version 9.2 or above downloadable from OTN.
  • OC4J (Oracle9iAS containers for J2EE) Release 9.0.3 Production downloadable from OTN.
  • Oracle XDK(XML Developer's Kit) for java downloadable from OTN.
  • ANT tool for building the Enterprise ARchive (EAR) file which can be downloaded from Jakarta Apache
  • Any JavaScript and XML enabled browser.

    Note:
    => This sample has been certified with Red Hat Linux Advanced Server 2.1, Solaris 5.6 and Windows NT 4.0, Windows 2000.
    =>
    Best viewed with browsers Netscape Navigator 6 or above, Microsoft Internet Explorer 5 or above. On Linux, best viewed with the Mozilla 1.3 or above browser.
    => Some parts of this application can be run only with Microsoft Internet Explorer(IE) 5 or above. The options which run only on MS IE are mentioned on the application page where they are accessed from.

Notations Used

Back To Top

This section will describe the terms used in the document.
For example,

Notation Description
XDK_HOME Folder where you have extracted Oracle9i XDK for Java utility . For example, C:\xdk or /home/xdk
OC4J_HOME Folder where OC4J is installed. For example, C:\oc4j or /home/oc4j
ANT_HOME Folder where ANT is installed. For example, C:\ant or /home/ant

Extracting the source code

Back To Top

The application files are stored in an archive named EmployeeInformation.jar. Download the archive and extract it to a convenient directory. Execute following command to extract  the files:

     jar xvf EmployeeInformation.jar

The archive EmployeeInformation.jar extracts the files that implement the Employee Information System. All the files are extracted into the -EmployeeInformation- directory.

Configuring the application

Back To Top


Creating the Employee Schema

To create the Employee schema follow the steps below :

1.      In Sql*Plus, Login to your Oracle9i Database using a user with sysdba privilege. For ex:

sqlplus> connect sys/change_on_install@db_alias as sysdba;

2.      Then, create a new user with the required privileges using the following commands in Sql*Plus :

sqlplus> CREATE USER empinfo IDENTIFIED BY empinfo;

sqlplus> GRANT connect,resource TO empinfo;

3.      Then, login as the user created above from Sql*Plus and run the script Employee.sql under the EmployeeInformation/sql directory extracted above. For example :

sqlplus> @<your_directory_path>\EmployeeInformation\sql\Employee.sql

This script will create all the tables, constraints, sequence and triggers required for the application.

Setting up XSQL Pages with OC4J

To setup XSQL pages with OC4J, first extract the XDK for Java utility downloaded earlier(refer to required software section) to a convenient directory. This directory will be referred as XDK_HOME. Then, follow the instructions below :

1.      Copy the oraclexsql.jar, xmlparserv2.jar, xdb.jar and xsu12.jar archives from the XDK_HOME directory to the OC4J_HOME\j2ee\home\lib directory.

2.       Copy the XSQLConfig.xml file in the C:\xdk\xdk\admin directory to the OC4J_HOME\j2ee\home\lib directory.

3.       Setting up the database connection for XSQL Pages : To setup the database connection,

a) Edit the XSQLConfig.xml file in the OC4J_HOME\j2ee\home\lib directory and add the following connection information within the

<connectiondefs>...</connectiondefs> tags :
<connection name="otn9i">
<username>username</username>
<password>password</password>
<dburl>jdbc:oracle:thin:@hostname:port:sid</dburl>
<driver>oracle.jdbc.driver.OracleDriver</driver>
</connection>

where,
username - is the name of the database user created above i.e empinfo
password - is the password of the empinfo user i.e empinfo
hostname - is the hostname of the machine where Oracle 9i database is running.
port - is the port on the hostname where the database listener is listening to.
sid - is the sid of your database.

Note : Do not change the Connection name "otn9i" as this is used in all the XSQL pages of the application.

b) Make sure that in the same XSQLConfig.xml file edited in step a, the value for the <factory> tag inside
<connection-manager>...</connection-manager> tags is set to the default value i.e oracle.xml.xsql.XSQLConnectionManagerFactoryImpl

4.       Edit the global-web-application.xml file under the OC4J_HOME\j2ee\home\config directory and include the following tags within the <web-app> tag :

<servlet>
<servlet-name>xsql</servlet-name>
<servlet-class>oracle.xml.xsql.XSQLServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>xsql</servlet-name>
<url-pattern>/*.xsql</url-pattern>
</servlet-mapping>

Save the File.

5.      After performing the above steps, restart the OC4J server.

Deploying the sample application in OC4J

Back To Top

Simple Deployment of the application in OC4J

Back To Top

1. Create a directory called as ·EmployeeInformation· under OC4J_HOME\j2ee\home\default-web-app\examples\jsp directory.

2. Move ·jsps·, ·images· and ·xml· directories in the ·EmployeeInformation· directory extracted above to this directory.

3. Stop the OC4J server if it is running. Goto the OC4J_HOME\lib directory. Rename the xmlparserv2.jar file to xmlparserv2.oc4jjar. Then, copy the xmlparserv2.jar file from XDK_HOME\lib directory to OC4J_HOME\lib directory.

4. Re-start the OC4J Server if it is not running and access the main page of the application using the URL :

http://<oc4jserver>:<port-no>/examples/jsp/EmployeeInformation/jsps/Welcome.jsp

where,

<oc4jserver> - is the hostname / ip-address of the machine where OC4J is installed.
<port-no> - is the port number on which oc4j server is listening. Default port is 8888.

EAR(Enterprise ARchive) Deployment

Back To Top


Note:
=> Ensure that you have downloaded and installed “ANT” tool (refer required software).
=> Ensure that you have JDK 1.3 or higher installed as it is required for compilation of the .java sources which builds the EAR file
=> ANT_HOME\bin is in the PATH.

1. Go to the 'EmployeeInformation' directory created above and type ant.

2.  ANT generates EmployeeInformation.ear file and places it under ·build· directory.

3.  Move this .ear file to OC4J_HOME\j2ee\home\applications directory.

4.  Go to OC4J_HOME\j2ee\home\config directory

5.  Edit http-web-site.xml file.

6.  Add following entry within the <web-site> tag
<web-app application="EmployeeInformation" name="EmployeeInformation"   root="/EmployeeInformation"/>

7.  Save this file

8.  Open server.xml file in the OC4J_HOME\j2ee\home\config directory and add the following entry within the <application-server> tag.
<application name="EmployeeInformation" path="../applications/EmployeeInformation.ear" />

9.  OC4J's hot-deploy feature will automatically auto-deploy and install the application for you.

10. Stop the OC4J server if it is running. Goto the OC4J_HOME\lib directory. Rename the xmlparserv2.jar file to xmlparserv2.oc4jjar. Then, copy the xmlparserv2.jar file from XDK_HOME\lib directory to OC4J_HOME\lib directory.

11.  Then, access the Application using the URL :

http://<oc4jserver>:<port-no>/EmployeeInformation/jsps/Welcome.jsp

where,

<oc4jserver> - is the hostname / ip-address of the machine where OC4J is installed.
<port-no> - is the port number on which oc4j server is listening. Default port is 8888.


 
E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy