DB2 Version 10.1 for Linux, UNIX, and Windows

pureXML - XQuery samples

These samples demonstrate support for efficient search and retrieval of XML via XQuery, SQL or a combination. The features demonstrated include: axes, FLWOR expressions, and queries written with XQuery and SQL/XML.

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\xquery (where %DB2PATH% is a variable that determines where DB2® database server is installed)
  • On UNIX: $HOME/sqllib/samples/xml/xquery (where $HOME is the home directory of the instance owner)
Table 1. pureXML - XQuery samples
Samples by language Sample program name Program description
CLI xpath.c Run simple XPath queries.
flwor.c Use the XQuery FLWOR expression.
sqlxquery.c Use SQL/XML queries.
xquery.c Execute nested XQuery FLWOR expressions. Pass parameters to the db2-fn:sqlquery function.
xquery_xmlproc.c Use XQuery in a stored procedure.
xquery_xmlproc_client.c Client program to call the routine in xquery_xmlproc.c
xquery_xmlproc_create.db2 CLP script to register the stored procedure in xquery_xmlproc.c
xquery_xmlproc_drop.db2 CLP script to drop the stored procedure in xquery_xmlproc.c
C xpath.sqc Run simple XPath queries.
flwor.sqc Use the XQuery FLWOR expression.
sqlxquery.sqc Use SQL/XML queries.
xquery.sqc Execute nested XQuery FLWOR expressions. Pass parameters to the db2-fn:sqlquery function.
xquery_xmlproc.sqc Use XQuery in a stored procedure.
client_xquery_xmlproc.sqc Client program to call the routine in xquery_xmlproc.sqc.
xquery_xmlproc_create.db2 CLP script to register the stored procedure in xquery_xmlproc.sqc.
xquery_xmlproc_drop.db2 CLP script to drop the stored procedure in xquery_xmlproc.sqc.
xupdate.sqc Use XQuery transform expression to insert, delete, update, replace, and rename one or more XML documents or fragments.
xqueryparam.sqc Pass parameters from XQuery to the SQL fullselect specified in the db2-fn:sqlquery function.
CLP xpath.db2 Run simple XPath queries.
flwor.db2 Use the XQuery FLWOR expression.
sqlxquery.db2 Use SQL/XML queries.
xquery.db2 Execute nested XQuery FLWOR expressions. Pass parameters to the db2-fn:sqlquery function.
xquery_explain.db2 EXPLAIN support for XQuery and SQL/XML statements.
xquery_xmlproc.db2 Use XQuery in a stored procedure.
xupdate.db2 Use XQuery transform expression to insert, delete, update, replace, and rename one or more XML documents or fragments.
xqueryparam.db2 Pass parameters from XQuery to the SQL fullselect specified in the db2-fn:sqlquery function.
JDBC XPath.java Run simple XPath queries.
Flwor.java Use the XQuery FLWOR expression.
SqlXQuery.java Use SQL/XML queries.
XQuery.java Execute nested XQuery FLWOR expressions. Pass parameters to the db2-fn:sqlquery function.
XQuery_XmlProc.java Use XQuery in a stored procedure.
Xquery_XmlProc_Client.java Client program to call the routine in Xquery_XmlProc.java.
Xquery_XmlProc_Create.db2 CLP script to register the stored procedure in Xquery_XmlProc.java.
Xquery_XmlProc_Drop.db2 CLP script to drop the stored procedure in Xquery_XmlProc.java.
XUpdate.java Use XQuery transform expression to insert, delete, update, replace, and rename one or more XML documents or fragments.
XQueryParam.java Pass parameters from XQuery to the SQL fullselect specified in the db2-fn:sqlquery function.
SQLJ XPath.sqlj Run simple XPath queries.
Flwor.sqlj Use the XQuery FLWOR expression.
SqlXQuery.sqlj Use SQL/XML queries.
XQuery.sqlj Execute nested XQuery FLWOR expressions. Pass parameters to the db2-fn:sqlquery function.