These samples demonstrate pureXML support for various
administration features, including: XML schema support, Utility support,
XML data indexing support.
These samples are available in various programming languages
and can be found in the language specific sub-directories in the following
location:
- On Windows:
%DB2PATH%\sqllib\samples\xml
(where %DB2PATH%
is a
variable that determines where Db2® database server is
installed)
- On UNIX:
$HOME/sqllib/samples/xml
(where
$HOME is the home directory of the instance owner)
Table 1. XML schema support - Samples
for schema registration, validation and compatible schema evolution
Samples By Language |
Sample program name |
Program description |
CLI |
xsupdate.c |
Update a registered XML schema ensuring that
the original and the new schemas are compatible. |
C |
xmlschema.sqc |
Register the XML schema to the database and use
the registered schema to validate and insert an XML document. |
CLP |
xmlschema.db2 |
Register the XML schema to the database and use
the registered schema to validate and insert an XML document. |
xsupdate.db2 |
Update a registered XML schema ensuring that
the original and the new schemas are compatible. |
JDBC |
XmlSchema.java |
Register the XML schema to the database and use the registered
schema to validate and insert an XML document. |
XsUpdate.java |
Update a registered XML schema ensuring that
the original and the new schemas are compatible. |
SQLJ |
XmlSchema.sqlj |
Register the XML schema to the database and
use the registered schema to validate and insert an XML document. |
Table 2. Utility support: Samples for
Import, export, runstats, db2look, reorg and db2batch support for
XML data type
Samples By Language |
Sample program name |
Program description |
C |
xmlrunstats.sqc |
Perform RUNSTATS on a table containing XML type
columns. |
lobstoxml.sqc |
Move LOB data into an XML column using IMPORT
and EXPORT commands. |
impexpxml.sqc |
Import and Export XML documents. |
xmlload.sqc |
Load XML documents into Db2 tables using the
various LOAD command options. |
CLP |
xmlrunstats.db2 |
Perform RUNSTATS on a table containing XML type
columns. |
xmlolic.db2 |
Reorganizes the indexes defined
on a table and how to reorganize nonpartitioned indexes on a range-partitioned
table. |
xmldb2batch.db2 |
db2batch support for XML datatype. |
xmldb2look.db2 |
db2look support for XML datatype. |
lobstoxml.db2 |
Move LOB data into an XML column using IMPORT
and EXPORT commands. |
impexpxml.db2 |
Import and Export XML documents. |
xmlload.db2 |
Load XML documents into Db2 tables using the
various LOAD command options. |
JDBC |
XmlRunstats.java |
Perform RUNSTATS on a table containing XML type
columns. |
Table 3. XML data indexing support: Samples
for indices over XML data
Samples By Language |
Sample program name |
Program description |
C |
xmlindex.sqc |
Create an index and use it in an XQuery query. |
xmlconst.sqc |
Create an index with UNIQUE and VARCHAR length
constraints using XML patterns. |
CLI |
xmlindex.c |
Create an index and use it in an XQuery query. |
xmlconst.c |
Create an index with UNIQUE and VARCHAR length
constraints using XML patterns. |
CLP |
xmlindex.db2 |
Create an index and use it in an XQuery query. |
xmlconst.db2 |
Create an index with UNIQUE and VARCHAR length
constraints using XML patterns. |
JDBC |
XmlIndex.java |
Create an index and use it in an XQuery query. |
XmlConst.java |
Create an index with UNIQUE and VARCHAR length
constraints using XML patterns. |
SQLJ |
XmlIndex.sqlj |
Create an index and use it in an XQuery query. |
XmlConst.sqlj |
Create an index with UNIQUE and VARCHAR length
constraints using XML patterns. |