Following software are required for running this application
Oracle9i
Database (Oracle 9.2.0.2 or later release)
Oracle9i JDeveloper downloadable
from OTN
(or)
JDK(Java Developer's Kit)1.3 or higher downloadable from http://java.sun.com Note: SAX Loader application has been certified with Red Hat Linux
Advanced Server 2.1, Solaris 5.6 and Windows NT 4.0, 2000.
Refer below for step-by-step instructions on extracting files,
installing and configuring other systems to successfully run this application.
Extracting the Source Code
The application files are stored in an archive named SAXLoader.jar.
Download the archive and extract it to a convenient directory. Execute following
command to extract the files:
jar xvf SAXLoader.jar
Note: You will find jar.exe in JDK_HOME\bin. Ensure JDK_HOME\bin
is present in your system path.
(JDK_HOME is the root directory of the JDKx.x installation).
The archive SAXLoader.jar
extracts the files that implement the application. All the files are extracted
into the SAXLoader directory.
Details of the individual files extracted that are related to this application
can be viewed in the Application files description section
.
Configuring the Application
Following steps need to be completed before compiling
the Java source code
1. Login to SQL*Plus in your Oracle9i
database using the Scott user account.
2. The XML Schema (to which the XML documents being inserted
need to conform to) should be registered in the database for
successful running of this application. Refer here
for more details on XML schema registration. For example:
3. The Schema based XMLType table into which the XML content
will be inserted should also exist in the database for
successful running of this application. If the table does not exist,
please create XMLType table based on the XML Schema. For example , say if your
XML schema URL is /xmldb/account.xsd
and you wish to create an XMLType table ACCOUNTS_TABLE based on
this schema, you can create one by executing SQL statement as:
CREATE TABLE accounts_table OF XMLType
XMLSCHEMA "/xmldb/account.xsd"
ELEMENT "ACCOUNT";
4. Edit the SAXLoader.xml file
extracted under SAXLoader\config directory. The
following parameters in theSAXLoader.xml
should be modified as described below:
a. Your database schema details. For example the following Elements tag value
needs to be modified to reflect the connecting database schema details:
<Driver>OCI</Driver>
You can specify OCI or THIN as
the text value for the Driver
For running the application using OCI driver you need some additional configuration
to be done. Please click here for details on the OCI
related configuration.
<Hostname>incq223B.idc.oracle.com</Hostname>
Hostname where the database is running
<Port>1521</Port>
Port where the database is running
<ServiceName>ora9201S</ServiceName>
Database Service Name
<SID>ora9201S</SID>
Database SID
<ServerMode>DEDICATED</ServerMode>
Database Server Mode
<Schema>SCOTT</Schema>
Database Schema Name
<Password>TIGER</Password>
Database Schema Password
<SchemaURL>/xmldb/account.xsd</SchemaURL>
Schema URL of the XML Schema registered
in Step 2 above
<Table>ACCOUNTS_TABLE</Table>
XMLType table where the XML content needs
to be inserted.
b. The details of the source file from which the data needs
to be inserted into the database. Also the node name in the file which denotes
the start of an XML document needs to be specified. For example: the following
Elements tag value need to be modified to reflect the required values:
The source file whose contents need to be
inserted. A sample file is provided with this application which can be found
at SAXLoader\SampleXMLFiles\Accounts.xml
<Element>ACCOUNT</Element>
The ELEMENT Tag that represents the starting
node of the XML documents in the source file. In the example we have provided
it is "ACCOUNT" which you can refer in the file under SAXLoader\SampleXMLFiles\Accounts.xml
c. Details for the number of threads that need to be spawned
and count of the INSERTS after which the database commit needs to take place,
during the insertion operation also needs to be specified. For example the following
Elements tag value need to be modified to reflect the the required values:
<ThreadCount>2</ThreadCount>
Number of threads that needs to be spawned
during the program execution.
If the program execution takes long time then the number of threads to be
spawned should be increased. Usually it is recommended to increase the thread
count for a large files.
<CommitCharge>3</CommitCharge>
Number of INSERTS after which the database
commit needs to take place during the insertion operation.
d. The logging mode for the application log that will be
generated during the execution of the program. This application provides for
logging the trace output onto the system console or write the same output into
a log file. The following element tag value needs to be modified to specify
the logging mode:
<Logger>CONSOLE</Logger>
Specify element's value as CONSOLE if you wish to trace the log
onto the System console.
Specify element's value as FILE if you wish the log to be written
into a trace file. Note: The trace file gets written to the SAXLoader\src directory.
5. Edit the BaseApplication.java file extracted
under SAXLoader\src\oracle\otnsamples\xmldb\saxloader\common\baseApp
directory. Modify the DEFAULT_CONNECTION_SETTINGS
static variable value so that it points to the location where SAXLoader.xml
has been extracted. For doing this substitute c:\\temp\\xml\\SAXLoader.xml
path in the following line with the directory path where SAXLoader.xml
has been extracted. Please specify the directory
path in accordance with the Operating System. public static final String DEFAULT_CONNECTION_SETTINGS
= "c:\\temp\\xml\\SAXLoader.xml";
6. JDBC OCI Configuration
For running the application with the OCI driver, the
system should have the Oracle database or Oracle database client installed.
Also, ensure that the following environment variables
are set:
On Windows, ensure the following:
i) ORACLE_HOME\lib directory is in the PATH
ii) ORACLE_HOME\bin directory is in
the PATH
On Solaris and Linux, (in Korn shell) :
Set LD_LIBRARY_PATH as follows: