Skip Headers
Oracle® Data Provider for .NET Developer's Guide
10g Release 2 (10.2)

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

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

OracleFailoverEventArgs Class

The OracleFailoverEventArgs class provides event data for the OracleConnection.Failover event. When database failover occurs, the OracleConnection.Failover event is triggered along with the OracleFailoverEventArgs object that stores the event data.

Class Inheritance

Object

  EventArgs

    OracleFailoverEventArgs

Declaration

// C#
public sealed class OracleFailoverEventArgs

Thread Safety

All public static methods are thread-safe, although instance methods do not guarantee thread safety.

Example (Oracle.DataAccess.Client only)

// Transparent Application Failover (TAF) Setup
// Refer Oracle® Database Net Services Administrator's Guide
 
// C#
 
using System;
using System.Threading;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
 
class FailoverSample
{
  static void Main(string[] args)
  {
    string constr = "User Id=scott;Password=tiger;Data Source=oracle";
    OracleConnection con = new OracleConnection(constr);
    con.Open();
 
    // Register the event handler OnFailover
    con.Failover += new OracleFailoverEventHandler(OnFailover);
 
    Console.WriteLine("Wait for a failover for 5 seconds");
    Thread.Sleep(5000);
 
    con.Close();
    con.Dispose();
  }
        
  // TAF callback function 
  static FailoverReturnCode OnFailover(object sender, 
    OracleFailoverEventArgs eventArgs)
  {
    switch (eventArgs.FailoverEvent)
    {
      case FailoverEvent.Begin:
      {
        Console.WriteLine("FailoverEvent.Begin - Failover is starting");
        Console.WriteLine("FailoverType = " + eventArgs.FailoverType);
        break;
      }      
      case FailoverEvent.End:
      {
        Console.WriteLine("FailoverEvent.End - Failover was successful");
        break;
      }
      case FailoverEvent.Reauth:
      {
        Console.WriteLine("FailoverEvent.Reauth - User reauthenticated");
        break;
      }
      case FailoverEvent.Error:
      {
        Console.WriteLine("FailoverEvent.Error - Failover was unsuccessful");
 
        // Sleep for 3 sec and Retry
        Thread.Sleep(3000);
        return FailoverReturnCode.Retry;
      }
      case FailoverEvent.Abort:
      {
        Console.WriteLine("FailoverEvent.Abort - Failover was unsuccessful");
        break;
      }
      default:
      {
        Console.WriteLine("Invalid FailoverEvent : " + eventArgs.FailoverEvent);
        break;
      }
    }
    return FailoverReturnCode.Success;
  }
}

Requirements

Namespace: Oracle.DataAccess.Client

Assembly: Oracle.DataAccess.dll

Comment: Not supported in a .NET stored procedure


OracleFailoverEventArgs Members

OracleFailoverEventArgs members are listed in the following tables:

OracleFailoverEventArgs Static Methods

The OracleFailoverEventArgs static methods are listed in Table 9-1.

Table 9-1 OracleFailoverEventArgs Static Methods

Methods Description
Equals Inherited from Object (Overloaded)

OracleFailoverEventArgs Properties

The OracleFailoverEventArgs properties are listed in Table 9-2.

Table 9-2 OracleFailoverEventArgs Properties

Name Description
FailoverType Specifies the type of failover the client has requested
FailoverEvent Indicates the state of the failover

OracleFailoverEventArgs Public Methods

The OracleFailoverEventArgs public methods are listed in Table 9-3.

Table 9-3 OracleFailoverEventArgs Public Methods

Name Description
Equals Inherited from Object (Overloaded)
GetHashCode Inherited from Object
GetType Inherited from Object
ToString Inherited from Object


OracleFailoverEventArgs Static Methods

The OracleFailoverEventArgs static methods are listed in Table 9-1.

Table 9-4 OracleFailoverEventArgs Static Methods

Methods Description
Equals Inherited from Object (Overloaded)


OracleFailoverEventArgs Properties

The OracleFailoverEventArgs properties are listed in Table 9-5.

Table 9-5 OracleFailoverEventArgs Properties

Name Description
FailoverType Specifies the type of failover the client has requested
FailoverEvent Indicates the state of the failover

FailoverType

This property indicates the state of the failover.

Declaration

// C#
public FailoverType FailoverType {get;} 

Property Value

A FailoverType enumeration value.

FailoverEvent

This property indicates the state of the failover.

Declaration

// C#
public FailoverEvent FailoverEvent {get;} 

Property Value

A FailoverEvent enumerated value.


OracleFailoverEventArgs Public Methods

The OracleFailoverEventArgs public methods are listed in Table 9-6.

Table 9-6 OracleFailoverEventArgs Public Methods

Name Description
Equals Inherited from Object (Overloaded)
GetHashCode Inherited from Object
GetType Inherited from Object
ToString Inherited from Object