DB2Xml Class

Represents XML data from a Db2® data source.

Namespace:
IBM.Data.DB2Types
Assembly:
IBM.Data.DB2 (in IBM.Data.DB2.dll)

Inheritance hierarchy


System.Object
   System.ValueType
      IBM.Data.DB2Types.DB2Xml

Syntax


[Visual Basic]
NotInheritable Public Class DB2Xml
   Inherits ValueType
[C#]
public sealed class DB2Xml : ValueType
[C++]
public __gc __sealed class DB2Xml : public ValueType
[JScript]
public class DB2Xml extends ValueType

Data server restrictions

Supported in: Db2 for IBM® i Version 7 Release 1 with Db2 Version 9.7 Fix Pack 5

Informix® data servers do not support this class.

Example

[C#] The function in this example prints the contents of an XML column, named DESCRIPTION, from a table called PRODUCT. To retrieve the XML column data, this example uses the DB2®DataReader.GetDB2Xml method, and passes the XML data to a DB2Xml object.

[C#]
public static void ReadXmlColumn(DB2Connection conn)
{
   DB2Xml xmlColValue;
   String xmlString;
   String cmdSQL = "SELECT DESCRIPTION FROM product WHERE pid='100-101-01'";
   DB2Command cmd = new DB2Command(cmdSQL, conn);
   DB2DataReader reader = cmd.ExecuteReader();
   try
   {
      while (reader.Read())
      {
         xmlColValue = reader.GetDB2Xml(0);
         xmlString = xmlColValue.GetString();
         Console.WriteLine(" {0} \n", xmlString);
      }
   }
   catch(Exception e)
   {
      Console.WriteLine(e.Message);
   }
   finally
   {
      reader.Close();
   }
}

Thread safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.