Skip Headers

Oracle® XML DB Developer's Guide
10g Release 1 (10.1)

Part Number B10790-01
Go to Documentation Home
Go to Book List
Book List
Go to Table of Contents
Go to Index
Go to Master Index
Master Index
Go to Feedback page

Go to previous page
Go to next page
View PDF

14 Using ODP.NET With Oracle XML DB

This chapter describes how to use Oracle Data Provider for .NET (ODP.NET) with Oracle XML DB.

This chapter contains these topics:

Overview of Oracle Data Provider for .NET (ODP.NET)

Oracle Data Provider for .NET (ODP.NET) is an implementation of a data provider for Oracle Database. ODP.NET uses Oracle native APIs to offer fast and reliable access to Oracle data and features from any .NET application. ODP.NET also uses and inherits classes and interfaces available in the Microsoft .NET Framework Class Library. The ODPNT supports the following LOBs as native datatypes with .NET: BLOBs, CLOBs, NCLOBs, and BFILEs.


ODP.NET supports XML natively in the database, through Oracle XML DB. ODP.NET XML support includes the following features:

For the .NET application developer, these features include the following:

ODP.NET Sample Code

This example retrieves XMLType data from the database to .NET and outputs the results:

//Create OracleCommand and query XMLType 
OracleCommand xmlCmd = new OracleCommand(); 
poCmd.CommandText = "SELECT po FROM po_tab";
poCmd.Connection = conn;
// Execute OracleCommand and output XML results to an OracleDataReader 
OracleDataReader poReader = poCmd.ExecuteReader(); 
// ODP.NET native XML data type object from XML DB 
OracleXmlType poXml; 
string str = ""; //read XML results 
while (poReader.Read()) 
  // Return OracleXmlType object of the specified XmlType column 
  poXml = poReader.GetOracleXmlType(0);     
  // Concatenate output for all the records 
  str = str + poXml.Value; 
} //Output XML results to the screen 

See Also:

Oracle Data Provider for .NET Developer's Guide for complete information about Oracle .NET support for XML DB.