Chapter 29: Extending PL/SQL XML Functionality with Java

The examples demonstrate the use fo Java Stored Procedures to process XML data in the Oracle database.

Example 1: Creating the Java Stroed Procedure to Process XML

1. Go to the $EXAMPLE_HOME/Chapter28/src/sql and open an SQL*Plus session connecting to the demo user:

>sqlplus /nolog

SQL> connect demo/demo

SQL>@createXSDBuilder_java

SQL>@createXSDBuilder_spec

SQL>@createXSDTable

SQL>@loadXSDData

SQL>@checkXSDBuilder

2. You can also compile the oracle.xml.sample.schema. XSDDBBuilder.java and use the XSDBuilder..deploy to deploy the sample Java program as discussed in the book.

Example 2: Resolving Reference URLS

1. Set up the Oracle XDK 10g xmlparserv2.jar in the Oracle JDeveloper.

2. Create a database connection to user schema in which you will create/run Java stored procedures.

3. Compile the oracle.xml.sample.schema.XSDBuilderResolver.java.

4. Deploy the XSDBuilderResolver .java to Oracle JVM by right clicking on the XSDVuilderResolveralidationSAX.deploy and pick up the database connection you just created .

5. Go to the $EXAMPLE_HOME/Chapter28/src/sql and open an SQL*Plus session connecting to the SYS user where we assume the password is oracle. Please update if needed:

>sqlplus /nolog

SQL>connect sys/oracle as sysdba

SQL>@grantPrivilege.sql

6. Open an SQL*Plus session connecting to the demo user :

 >sqlplus /nolog

SQL> connect demo/demo

SQL>@checkXSDBuilderResolver

Example 3: SAX-based XML Schema Validation

1. Set up the Oracle XDK 10g xmlparserv2.jar in the Oracle JDeveloper.

2. Create a database connection to user schema in which you will create/run Java stored procedures.

3. Compile the oracle.xml.sample.schema.XSDValidationSAX.java.

4. Deploy the XSDValidationSAX.java to Oracle JVM by right clicking on the XSDBuilderResolver.deploy and pick up the database connection you just created .

5. Go to the $EXAMPLE_HOME/Chapter28/src/sql and open an SQL*Plus session connecting to the demo user :

 >sqlplus /nolog

SQL> connect demo/demo

SQL>@checkXSDValidation

Example 4: SAX-based XML Serialization with Content Normalization

1. Set up the Oracle XDK 10g xmlparserv2.jar in the Oracle JDeveloper.

2. Create a database connection to user schema in which you will create/run Java stored procedures.

3. Compile the oracle.xml.sample.parser.XMLNormalize.java.

4. Deploy the XSDValidationSAX.java to Oracle JVM by right clicking on the XMLNormalize.deploy and pick up the database connection you just created .

5. Go to the $EXAMPLE_HOME/Chapter28/src/sql and open an SQL*Plus session connecting to the demo user :

 >sqlplus /nolog

SQL> connect demo/demo

SQL>@checkXMLNormalize

Copyright © 2003 Last Update: 05/06/2004