DB2 Version 9.7 for Linux, UNIX, and Windows

db2-xdb:defaultSQLSchema decomposition annotation

The db2-xdb:defaultSQLSchema annotation specifies the default SQL schema for all table names referenced in the XML schema that are not explicitly qualified using the db2-xdb:table annotation.

<db2-xdb:defaultSQLSchema> belongs to the set of decomposition annotations that can be added to an XML schema document to describe the mappings between elements and attributes of XML documents to DB2® base tables. The decomposition process uses the annotated XML schema to determine how elements and attributes of an XML document should be decomposed into DB2 tables.

Annotation type

Child element of <xs:appinfo> that is a child of a global <xs:annotation> element.

How to specify

db2-xdb:defaultSQLSchema is specified in the following way (where value represents a valid value for the annotation):
<xs:schema>
  <xs:annotation>
    <xs:appinfo>
      <db2-xdb:defaultSQLSchema>value</db2-xdb:defaultSQLSchema>
    </xs:appinfo>
  </xs:annotation>
  …
</xs:schema>

Namespace

http://www.ibm.com/xmlns/prod/db2/xdb1

Valid values

Either an ordinary or delimited SQL schema name. Ordinary, or undelimited, SQL schema names are case-insensitive. To specify a delimited SQL schema, use quotation marks that are normally used to delimit SQL identifiers. SQL schema names that contain the special characters '<' and '&' must be escaped in the XML schema document.

Details

All tables referenced in annotated schemas must be qualified with their SQL schema. Tables can be qualified in two ways, either by explicitly specifying the <db2-xdb:SQLSchema> child element of the <db2-xdb:table> annotation or by using the <db2-xdb:defaultSQLSchema> global annotation. For any unqualified table name, the value specified in <db2-xdb:defaultSQLSchema> is used as its SQL schema name. If multiple schema documents in an annotated schema specify this annotation, all values must be the same.

Example

The following example shows how the ordinary, or undelimited, SQL identifier admin is defined as the SQL schema for all unqualified tables in the annotated schema:
<xs:schema xmlns:xs="http:⁄⁄www.w3.org⁄2001⁄XMLSchema"
                xmlns:db2-xdb="http:⁄⁄www.ibm.com⁄xmlns⁄prod⁄db2⁄xdb1">
  <xs:annotation>
    <xs:appinfo>
      <db2-xdb:defaultSQLSchema>admin<⁄db2-xdb:defaultSQLSchema>
    <⁄xs:appinfo>
  <⁄xs:annotation>
  …
<⁄xs:schema>
The following example shows how the delimited SQL identifier admin schema is defined as the SQL schema for all unqualified tables in the annotated schema. Note that admin schema must be delimited with quotation marks:
<xs:schema xmlns:xs="http:⁄⁄www.w3.org⁄2001⁄XMLSchema"
xmlns:db2-xdb="http:⁄⁄www.ibm.com⁄xmlns⁄prod⁄db2⁄xdb1">
  <xs:annotation>
    <xs:appinfo>
      <db2-xdb:defaultSQLSchema>"admin schema"<⁄db2-xdb:defaultSQLSchema>
    <⁄xs:appinfo>
  <⁄xs:annotation>
  …
<⁄xs:schema>