This document contain instructions on how to configure the
Oracle JDBC driver with the Sun ONE Web Server. The samples
included with the web server include instructions for configuring them to work with an Oracle database. You can use jdbc-simple as a
template to configure Oracle to work with other
applications. (For database-related information, see the Oracle
documentation.)
To learn about basic operations with Oracle and the Sun ONE Web
Server, read the following sections:
Configuration and Set Up
Instructions
Configure Sun ONE Web Server with Oracle Type 4 JDBC Driver
You can add the Oracle JDBC driver to the web server
classpath as described in this section.
Open the server.xml file of the web server instance. Add the
location of the Oracle driver in the classpathsuffix. For example,
check the following sample JAVA element (with
/oracle/jdbc/lin/classes12.jar as the <Oracle jdbc driver>):
Change it from this:
<JAVA javahome="/ws61/bin/https/jdk" serverclasspath="/ws61/bin/https/jar/webserv-rt.jar:
${java.home}/lib/tools.jar:/ws61/bin/https/jar/webserv-ext.jar:/ws61/bin/https/jar/webserv-jstl.jar:
/ws61/bin/https/jar/ktsearch.jar" classpathsuffix="" envclasspathignored="on" debug="false"
debugoptions="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n" dynamicreloadinterval="2">
........
........
</JAVA>
to this:
<JAVA javahome="/ws61/bin/https/jdk" serverclasspath="/ws61/bin/https/jar/webserv-rt.jar:${java.home}/lib/tools.jar:
/ws61/bin/https/jar/webserv-ext.jar:/ws61/bin/https/jar/webserv-jstl.jar:
/ws61/bin/https/jar/ktsearch.jar" classpathsuffix="/oracle/jdbc/lin/classes12.jar"
envclasspathignored="on" debug="false"
debugoptions="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n" dynamicreloadinterval="2">
........
........
</JAVA>
NOTE: The web server must be restarted to update the
classpath. If you are using a Type 2 driver, you must also add <oracle_home>/lib to
the nativelibrarypathprefix .
Create the Database Users and Schemas for the Sample
Application
The following steps assume that you have access to a running Oracle
RDBMS. Note that the user creation script will drop any existing
users with the same name.
Use <install_root>/plugins/java/samples/webapps/docs/cr_ora_user.sql
to create a specific sample Oracle user. This script will create the
user on the specified tablespace.
For example, using
sqlplus login as
system/manager:
<SQL>
@cr_ora_user.sql user_name
password tablespace_name
NOTE: tablespace_name If
you want to create a separate tablespace for all samples, you can
use the <install_root>/plugins/java/samples/webapps/docs/cr_ora_tb.sql
script. If you don't want to create the new tablespace, you can
use the sql command "select tablespace_name, status
from DBA_TABLESPACES" to see the available online
tablespaces (run this sql command as system/manager).
You can use sqlplus to execute SQL statements found in the .sql
files within the src/sql directory of each JDBC-relevant
sample.
NOTE: If only one .sql file exists in the src/sql directory,
then it will work with both Oracle and PointBase.
For example, here are the detailed steps for configuring the jdbc-simple
sample to work with Oracle:
(a) Use sqplus and
login as system/manager to create oracle user jdbc/jdbc on the
specified tablespace.
(b) Load the
schema for the jdbc-simple application as the user 'jdbc' by using
the script jdbc-simple-ora.sql located in
<install_root>/plugins/java/samples/webapps/jdbc/simple/src/sql.
<SQL>
@jdbc-simple-ora.sql
(c) Run the application (refer to jdbc
simple sample).
(d) In the same way, you can use the same 'jdbc' user for all of the
samples, or you can create a different user for every
sample.
Registering JDBC Resources and Defining
Connection Pools
You can reveiw the sample common.xml and build.xml files to learn
how to use the ant to define JDBC
resources and connection pools. Also refer to the following: (1) Using
Ant with the Samples (2) Deploying
Samples and Creating the Resources using Admin GUI
Troubleshooting and Notes
JDBC/Blob Sample: If the Type 4 JDBC driver is used as
explained in this document, the uploaded file cannot exceed 5 KB. The
workaround is to use the Type 2 OCI driver. Here are the steps to set up
the driver:
1. In the administrative console, modify the property for
connection pool jdbc-blobPool. The value of the url
property should be: jdbc:oracle:oci8@db_alias
(db_alias should be defined in
TNS).
2. Add the path of the driver to the classpathsuffix
in server.xml.
3. Restart the web
server. |