Skip Headers

Oracle Data Provider for .NET Developer's Guide
Release 9.2.0.2

Part Number A96160-01
Go To Table Of Contents
Contents
Go To Index
Index

Go to previous page Go to next page

1
Introducing Oracle Data Provider for .NET

This chapter introduces Oracle Data Provider for .NET (ODP.NET), an implementation of a data provider for the Oracle database.

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 the 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.

For programmers using Oracle Provider for OLE DB, ADO (ActiveX Data Objects) provides an automation layer that exposes an easy programming model. ADO.NET provides a similar programming model, but without the automation layer, for better performance. More importantly, the ADO.NET model allows native providers such as ODP.NET to expose Oracle-specific features and datatypes.

ODP.NET Assembly

Oracle.DataAccesss.dll assembly provides two namespaces:

Oracle.DataAccess.Client Classes

This namespace is the Oracle Data Provider for .NET (ODP.NET). Table 1-1 lists the client classes:

Table 1-1 Oracle.DataAccess.Client Classes  
Class Description

OracleConnection Class

An OracleConnection object represents a connection to an Oracle database

OracleTransaction Class

An OracleTransaction object represents a local transaction

OracleParameter Class

An OracleParameter object represents a parameter for an OracleCommand

OracleParameterCollection Class

An OracleParameterCollection object represents a collection of OracleParameters

OracleCommand Class

An OracleCommand object represents a SQL command, a stored procedure, or a table name

OracleDataReader Class

An OracleDataReader object represents a forward-only, read-only, in-memory result set

OracleDataAdapter Class

An OracleDataAdapter object represents a data provider object that communicates with the DataSet

OracleCommandBuilder Class

An OracleCommandBuilder object provides automatic SQL generation for the OracleDataAdapter when updates are made to the database

OracleError Class

The OracleError object represents an error reported by an Oracle database

OracleErrorCollection Class

An OracleErrorCollection object represents a collection of OracleErrors

OracleException Class

The OracleException object represents an exception that is thrown when Oracle Data Provider for .NET encounters an error

OracleRowUpdatedEventHandler Delegate

The OracleRowUpdatedEventHandler delegate represents the signature of the method that handles the OracleDataAdapter.RowUpdated event

OracleRowUpdatedEventArgs Class

The OracleRowUpdatedEventArgs object provides event data for the OracleDataAdapter.RowUpdated event

OracleRowUpdatingEventArgs Class

The OracleRowUpdatingEventHandler delegate represents the signature of the method that handles the OracleDataAdapter.RowUpdating event

OracleRowUpdatingEventArgs Class

The OracleRowUpdatedEventArgs object provides event data for the OracleDataAdapter.RowUpdating event

OracleInfoMessageEventHandler Delegate

The OracleInfoMessageEventHandler delegate represents the signature of the method that handles the OracleConnection.InfoMessage event

OracleInfoMessageEventArgs Class

The OracleInfoMessageEventArgs object provides event data for the OracleConnection.InfoMessage event

OracleInfoMessageEventHandler Delegate

The OracleFailoverEventHandler delegate represents the signature of the method that handles the OracleConnection.Failover event

OracleFailoverEventArgs Class

The OracleFailoverEventArgs object provides event data for the OracleConnection.Failover event

OracleGlobalization Class

The OracleGlobalization class is used to obtain and set the Oracle globalization settings of the session, thread, and local computer (read-only)

Oracle.DataAccess.Types Classes and Structures

The Oracle.DataAccess.Types namespace provides classes and structures for Oracle native types that can be used with Oracle Data Provider for .NET. Table 1-2 lists these structures and classes:

Table 1-2 Oracle.DataAccess.Types Classes and Structures  
Classes and Structures Description

ODP.NET Type Structures

OracleBinary Structure

The OracleBinary structure represents a variable-length stream of binary data

OracleDate Structure

The OracleDate structure represents the Oracle DATE datatype

OracleDecimal Structure

The OracleDecimal structure represents an Oracle NUMBER in the database or any Oracle numeric value

OracleIntervalDS Structure

The OracleIntervalDS structure represents the Oracle INTERVAL DAY TO SECOND datatype

OracleIntervalYM Structure

The OracleIntervalYM structure represents the Oracle INTERVAL YEAR TO MONTH datatype

OracleString Structure

The OracleString structure represents a variable-length stream of characters

OracleTimeStamp Structure

The OracleTimeStamp structure represents the Oracle TimeStamp datatype

OracleTimeStampLTZ Structure

The OracleTimeStampLTZ structure represents the Oracle TIMESTAMP WITH LOCAL TIME ZONE data type

OracleTimeStampTZ Structure

The OracleTimeStampTZ structure represents the Oracle TIMESTAMP WITH TIME ZONE data type

ODP.NET Type Exceptions (thrown only by ODP.NET Type structures)

OracleTypeException Class

The OracleTypeException object is the base exception class for handling exceptions that occur in the ODP.NET Type classes

OracleNullValueException Class

The OracleNullValueException represents an exception that is thrown when trying to access an ODP.NET Type structure that is null

OracleTruncateException Class

The OracleTruncateException class represents an exception that is thrown when truncation in an ODP.NET Type class occurs

ODP.NET Type Classes

OracleBFile Class

An OracleBFile is an object that has a reference to BFILE data. It provides methods for performing operations on BFiles

OracleBlob Class

An OracleBlob object is an object that has a reference to BLOB data. It provides methods for performing operations on BLOBs

OracleClob Class

An OracleClob is an object that has a reference to CLOB data. It provides methods for performing operations on CLOBs

OracleRefCursor Class

An OracleRefCursor object represents an Oracle REF CURSOR

Using ODP.NET in a Simple Application

The following is a very simple C# application that connects to an Oracle database and displays its version number before disconnecting.

using System; 
using Oracle.DataAccess.Client; 

class Example 
{ 
  OracleConnection con; 

  void Connect() 
  { 
    con = new OracleConnection(); 
    con.ConnectionString = "User Id=scott;Password=tiger;Data Source=oracle"; 
    con.Open(); 
    Console.WriteLine("Connected to Oracle"); 
  } 

  void Close() 
  { 
    con.Close(); 
    con.Dispose(); 
  } 
  
  static void Main() 
  { 
    Example example = new Example(); 
    example.Connect(); 
    example.Close(); 
  } 
} 


Note:

Additional samples are provided in the ORACLE_BASE\ORACLE_HOME\ODP.NET\Samples directory.



Go to previous page Go to next page
Oracle
Copyright © 2002 Oracle Corporation.

All Rights Reserved.
Go To Table Of Contents
Contents
Go To Index
Index