layer for web applications. A JDBC connector for Oracle is needed to integrate an external Oracle Database server with the Tomcat Web server. This section describes the steps for connecting the Tomcat Web server to an Oracle database.

Obtaining and Installing the Oracle JDBC Driver

Perform the following steps from the Tomcat Web server:

1.Download the JDBC driver for Oracle 10g Release 2 from the Oracle website at: http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html

NOTE: For the Oracle JDBC driver with JDK 1.4 and 1.5, use the ojdbc14.jar file.

2.Copy the JDBC driver to the Tomcat environment by entering the following command:

# cp ojdbc14.jar $CATALINA_HOME/common/lib

Creating an Oracle Data Source

To create a data source binding for the Oracle JDBC driver data source, perform the following on the Tomcat Web server:

Create a file named $CATALINA_HOME/conf/context.xml and insert the following lines:

<Context>

<Resource name="jdbc/oracleDB" type="javax.sql.DataSource" password="<DB_PASSWORD>"

driverClassName="oracle.jdbc.driver.OracleDriver" maxIdle="2" maxWait="5000" username="<DB_USERNAME>"

url="jdbc:oracle:thin:@ <IP_OR_NAME_OF_ORACLE_SERVER>:1521:<ORACLE_SID>" maxActive="4"/> </Context>

For example:

<Resource name="jdbc/oracleDB" type="javax.sql.DataSource" password="osmspass"

driverClassName="oracle.jdbc.driver.OracleDriver" maxIdle="2" maxWait="5000" username="osmsusr" url="jdbc:oracle:thin:@192.168.1.100:1521:OSMSDB" maxActive="4"/>

Configuring the Oracle Server

Perform the following steps on the Oracle Database server:

1.Verify that the Oracle server and the listener are running by entering the following command:

#lsnrctl status

2.Create a database user and grant the proper privileges, which should be the same as the user in the $CATALINA_HOME/conf/context.xml file, by entering the following commands:

#sqlplus / as sysdba

SQL> create user osmsusr identified by osmspass;

SQL> grant connect,resource to osmsusr;

Testing the Oracle Database Connectivity

Test the connectivity between the Tomcat server and the Oracle database by performing the following steps on the Tomcat Web server:

34