Skip Headers

Oracle® Data Provider for .NET Developer's Guide
Release 9.2.0.4

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

Go to previous page Go to beginning of chapter Go to next page

Oracle.DataAccess.Client Namespace, 4 of 30


OracleConnection Class

An OracleConnection object represents a connection to an Oracle database.

Class Inheritance

Object

  MarshalByRefObject

    Component

      OracleConnection

Declaration
// C#
public sealed class OracleConnection : Component,
   IDbConnection, ICloneable  
Thread Safety

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

Example
// C#
//  Uses connection to create and return an OracleCommand object.
...
string ConStr = "User Id=myschema;Password=mypassword;" +
      "Data Source=oracle;";
OracleConnection con = new OracleConnection(ConStr);
con.Open();
OracleCommand cmd = con.CreateCommand();

cmd.CommandText = "insert into mytable values (99, 'foo')";
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
...

Requirements

Namespace: Oracle.DataAccess.Client

Assembly: Oracle.DataAccess.dll

See Also:

OracleConnection Members

OracleConnection members are listed in the following tables:

OracleConnection Constructors

OracleConnection constructors are listed in Table 4-19.

Table 4-19 OracleConnection Constructors
Constructor Description

OracleConnection Constructors

Instantiates a new instance of the OracleConnection class (Overloaded)

OracleConnection Static Methods

OracleConnection static methods are listed in Table 4-20.

Table 4-20 OracleConnection Static Methods  
Methods Description

Equals

Inherited from Object (Overloaded)

OracleConnection Properties

OracleConnection properties are listed in Table 4-21

Table 4-21 OracleConnection Properties  
Name Description

ConnectionString

Specifies connection information used to connect to an Oracle database

ConnectionTimeout

Specifies the maximum amount of time that the Open() method can take to obtain a pooled connection before terminating the request

Container

Inherited from Component

DataSource

Specifies the Oracle Net Service Name (also known as TNS alias) that identifies an Oracle database instance

ServerVersion

Specifies the version number of the Oracle database to which the OracleConnection has established a connection

Site

Inherited from Component

State

Specifies the current state of the connection

OracleConnection Public Methods

OracleConnection public methods are listed in Table 4-22.

Table 4-22 OracleConnection Public Methods  
Public Method Description

BeginTransaction

Begins a local transaction (Overloaded)

ChangeDatabase

Not Supported

Clone

Creates a copy of an OracleConnection object

Close

Closes the database connection

CreateCommand

Creates and returns an OracleCommand object associated with the OracleConnection object

CreateObjRef

Inherited from MarshalByRefObject

Dispose

Inherited from Component

Equals

Inherited from Object (Overloaded)

GetHashCode

Inherited from Object

GetLifetimeService

Inherited from MarshalByRefObject

GetSessionInfo

Returns or refreshes the property values of the OracleGlobalization object that represents the globalization settings of the session (Overloaded)

GetType

Inherited from Object

InitializeLifetimeService

Inherited from MarshalByRefObject

Open

Opens a database connection with the property settings specified by the ConnectionString

OpenWithNewPassword

Opens a new connection with the new password

SetSessionInfo

Alters the session's globalization settings with the property values provided by the OracleGlobalization object

ToString

Inherited from Object

OracleConnection Events

OracleConnection events are listed in Table 4-23.

Table 4-23 OracleConnection Events  
Event Name Description

Disposed

Inherited from Component

Failover

An event that is triggered when an Oracle failover occurs

InfoMessage

An event that is triggered for any message or warning sent by the database

StateChange

An event that is triggered when the connection state changes

OracleConnection Event Delegates

OracleConnection event delegates are listed in Table 4-24.

Table 4-24 OracleConnection Event Delegates  
Event Delegate Name Description

OracleFailoverEventHandler

An event delegate that handles the Failover event

OracleInfoMessageEventHandler

An event delegate that handles the InfoMessage event

StateChangeEventHandler

An event delegate that handles the StateChange event

See Also:

OracleConnection Constructors

OracleConnection constructors instantiate new instances of the OracleConnection class.

Overload List:

OracleConnection()

This constructor instantiates a new instance of the OracleConnection class using default property values.

Declaration
// C#
public OracleConnection();
Remarks

The properties for OracleConnection are set to the following default values:

OracleConnection(String)

This constructor instantiates a new instance of the OracleConnection class with the provided connection string.

Declaration
// C#
public OracleConnection(String connectionString);
Parameters
Remarks

The ConnectionString property is set to the supplied connectionString. The ConnectionString property is parsed and an exception is thrown if it contains invalid connection string attributes or attribute values.

The properties of the OracleConnection object default to the following values unless they are set by the connection string:

OracleConnection Static Methods

OracleConnection static methods are listed in Table 4-25.

Table 4-25 OracleConnection Static Methods  
Methods Description

Equals

Inherited from Object (Overloaded)

See Also:

OracleConnection Properties

OracleConnection properties are listed in Table 4-26

Table 4-26 OracleConnection Properties  
Name Description

ConnectionString

Specifies connection information used to connect to an Oracle database

ConnectionTimeout

Specifies the maximum amount of time that the Open() method can take to obtain a pooled connection before terminating the request

Container

Inherited from Component

DataSource

Specifies the Oracle Net Service Name (also known as TNS alias) that identifies an Oracle database instance

ServerVersion

Specifies the version number of the Oracle database to which the OracleConnection has established a connection

Site

Inherited from Component

State

Specifies the current state of the connection

See Also:

ConnectionString

This property specifies connection information used to connect to an Oracle database.

Declaration
// C#
public string ConnectionString{get; set;} 
Property Value

If the connection string is supplied through the constructor, this property is set to that string.

Implements

IDbConnection

Exceptions

ArgumentException - An invalid syntax is specified for the connection string.

InvalidOperationException - ConnectionString is being set while the connection is open.

Remarks

The default value is an empty string.

ConnectionString must be a string of attribute name and value pairings, separated by a semi-colon, for example:

// C#
OracleConnection con = new OracleConnection();
con.ConnectionString = "User Id=MYSCHEMA;Password=MYPASSWORD;" + 
   "Data Source=Oracle";

If the ConnectionString is not in a proper format, an exception is thrown. All spaces are ignored unless they are within double quotes.

When the ConnectionString property is set, the OracleConnection object immediately parses the string for errors. An ArgumentException is thrown if the ConnectionString contains invalid attributes or invalid values. Attribute values for User Id, Password, Proxy User Id, Proxy Password, and Data Source (if provided) are not validated until the Open method is called.

The connection must be closed to set the ConnectionString property. When the ConnectionString property is reset, all previously set values are reinitialized to their default values before the new values are applied.

The Oracle database supports case-sensitive user names. To connect as a user whose name is of mixed case, for example, "MySchema", the User Id attribute value must be surrounded by double quotes, as follows:

// C#
OracleConnection con = new OracleConnection();
con.ConnectionString = "User Id=\"MySchema\";Password=MYPASSWORD;" +
    "Data Source=Oracle";

However, if the Oracle user name is all upper case, the User Id connection string attribute can be set to that user name without the use of the double quotes since User Ids that are not doubled-quoted are converted to all upper case when connecting. Single quotes are not supported.

See Also:

"Example" for a complete example

If a connection string attribute is set more than once, the last setting takes effect and no exceptions are thrown.

Boolean connection string attributes can be set to either true, false, yes, or no.

Supported connection string attributes:

Table 4-27 lists the supported connection string attributes.

Table 4-27 Supported Connection String Attributes  
Connection String Attribute Default value Description

Connection Lifetime

0

Maximum life time (in seconds) of the connection

This attribute specifies the lifetime of the connection in seconds. Before the Connection is placed back into the pool, the lifetime of the connection is checked. If the lifetime of the connection exceeds this property value, the connection is closed and disposed. If this property value is 0, the connection lifetime is never checked. Connections that have exceeded their lifetimes are not closed and disposed of, if doing so brings the number of connection in the pool below the Min Pool Size.

Connection Timeout

15

Maximum time (in seconds) to wait for a free connection from the pool

This attribute specifies the maximum amount of time (in seconds) that the Open() method can take to obtain a pooled connection before it terminates the request. This value comes into effect only if no free connection is available from the connection pool and the Max Pool Size is reached. If a free connection is not available within the specified time, an exception is thrown. Connection Timeout does not limit the time required to open new connections.

This attribute value takes effect for pooled connection requests and not for new connection requests.

Data Source

empty string

Oracle Net Service Name that identifies the database to connect to

This attribute specifies the Oracle Net Service Name (formerly known as TNS alias) that identifies an Oracle database instance. This attribute must be set to connect to a remote database.

DBA Privilege

empty string

Administrative privileges SYSDBA or SYSOPER

This connection string attribute only accepts SYSDBA or SYSOPER as the attribute value. It is case insensitive.

Decr Pool Size

1

Number of connections that are closed when an excessive amount of established connections are unused.

 

 

This connection string attribute controls the maximum number of unused connections that are closed when the pool regulator makes periodic checks. The regulator thread is spawned every 3 minutes and closes up to Decr Pool Size amount of pooled connections if they are not used. The pool regulator never takes the total number of connections below the Min Pool Size by closing pooled connections.

Enlist

true

Serviced Components automatically enlist in distributed transactions

If this attribute is set to true, the connection is automatically enlisted in the thread's transaction context. If this attribute is false, no enlistments are made. This attribute can be set to either true, false, yes, or no.

Incr Pool Size

5

Number of connections established when all connections in pool are used

This connection string attribute determines the number of new connections that are established when a pooled connection is requested, but no unused connections are available and Max Pool Size is not reached. If new connections have been created for a pool, the regulator thread skips a cycle and does not have an opportunity to close any connections for 6 minutes. Note, however, that some connections can be still be closed during this time if their lifetime has been exceeded.

Max Pool Size

100

Maximum number of connections in a pool

This attribute specifies the maximum number of connections allowed in the particular pool used by that OracleConnection. Simply changing this attribute in the connection string does not change the Max Pool Size restriction on a currently existing pool. Doing so simply creates a new pool with a different Max Pool Size restriction. This attribute must be set to a value greater than the Min Pool Size. This value is ignored unless Pooling is turned on.

Min Pool Size

1

Minimum number of connections in a pool

This attribute specifies the minimum number of connections to be maintained by the pool during its entire lifetime. Simply changing this attribute in the connection string does not change the Min Pool Size restriction on a currently existing pool. Doing so simply creates a new pool with a different Min Pool Size restriction. This value is ignored unless Pooling is turned on.

Password

empty string

Password for the user specified by User Id

This attribute specifies an Oracle user's password. Password is case insensitive.

Persist Security Info

false

Enables or disables the retrieval of password in the connection string

If this attribute is set to false, the Password value setting is not returned when the application requests the ConnectionString after the connection is successfully opened by the Open() method. This attribute can be set to either true, false, yes, or no.

Pooling

true

Enables or disables connection pooling

This attribute specifies whether connection pooling is to be used. Pools are created using an attribute value matching algorithm. This means that connection strings which only differ in the number of spaces in the connection string use the same pool. If two connection strings are identical except that one sets an attribute to a default value while the other does not set that attribute, both requests obtain connections from the same pool. This attribute can be set to either true, false, yes, or no.

Proxy User Id

empty string

User name of the proxy user

This connection string attribute specifies the middle-tier user, or the proxy user, who establishes a connection on behalf of a client user specified by the User Id attribute. ODP.NET attempts to establish a proxy connection if either the Proxy User Id or the Proxy Password attribute is set to a non-empty string.

 

 

For the proxy user to connect to an Oracle database using OS authentication, the Proxy User Id must be set to "/". The Proxy Password is ignored in this case. The User Id cannot be set to "/" when establishing proxy connections. The case of this attribute value is preserved if it is surrounded by double quotes.

Proxy Password

empty string

Password of the proxy user

This connection string attribute specifies the password of the middle-tier user or the proxy user. This user establishes a connection on behalf of a client user specified by the User Id attribute. ODP.NET attempts to establish a proxy connection if either the Proxy User Id or the Proxy Password attribute is set to a non-empty string.

User Id

empty string

Oracle user name

This attribute specifies the Oracle user name. The case of this attribute value is preserved if it is surrounded by double quotes. For the user to connect to an Oracle database using OS authentication, set the User Id to "/". Any Password attribute setting is ignored in this case.

Example

This code example shows that the case of the User Id attribute value is not preserved unless it is surrounded by double quotes. The example also demonstrates when connection pools are created and when connections are drawn from the connection pool.

// C#
// Assume users "MYSCHEMA"and "MySchema" exist in the database 
...
OracleConnection con1 = new OracleConnection();
con1.ConnectionString = "User Id=myschema;Password=mypassword;" +
     "Data Source=oracle;";
con1.Open();  // Attempts to connect as "MYSCHEMA/MYPASSWORD"
              // A new connection is created; A new Connection Pool X is created
con1.Dispose(); // Connection is placed back into Pool X

OracleConnection con2 = new OracleConnection();
con2.ConnectionString = "User Id=MySchema;Password=MyPassword;" +
     "Data Source=oracle;";
con2.Open(); // Attempts to connect as "MYSCHEMA/MYPASSWORD" A connection is
             // obtained from Pool X; A new connection is NOT created.
con2.Dispose(); // Connection is placed back into Pool X

OracleConnection con3 = new OracleConnection();
con3.ConnectionString = "User Id=\"MYSCHEMA\";Password=MYPASSWORD;" +
     "Data Source=oracle;";
con3.Open(); // Attempts to connect as "MYSCHEMA/MYPASSWORD" A connection is
             // obtained from Pool X; A new connection is NOT created.
con3.Dispose(); // Connection is placed back into Pool X

OracleConnection con4 = new OracleConnection();
con4.ConnectionString = "User Id=\"MySchema\";Password=mypassword;" +
     "Data Source=oracle;";
con4.Open(); // Attempts to connect as "MySchema/MYPASSWORD"
             // A new connection is created; A new Connection Pool Y is created
con4.Dispose(); // Connection is placed back into Pool Y

OracleConnection con5 = new OracleConnection();
con5.ConnectionString = "User Id=MySchema;Password=mypassword;" +
     "Data Source=oracle;    ";
con5.Open(); // Attempts to connect as "MYSCHEMA/MYPASSWORD"
             // A connection is obtained from Connection Pool X
             // Extra spaces in the connection string do not force creation
             // of a new pool
con5.Dispose(); // Connection is placed back into Pool X

OracleConnection con6 = new OracleConnection();
con6.ConnectionString = "User Id=MySchema;Password=mypassword;" +
     "Data Source=oracle;Pooling=true;";
con6.Open(); // Attempts to connect as "MYSCHEMA/MYPASSWORD"
             // A connection is obtained from Connection Pool X. "Pooling=true"
             // in the connection string does not force creation of a new pool
             // since the initial connection was established using the default
             // value of "Pooling=true".  Note that even if the connection
             // string had "POOLING=Yes", a new connection pool will not be
             // created since they both enable pooling.  The same rule applies
             // to other connection string attributes as well.
con6.Dispose(); // Connection is placed back into Pool X
...

See Also:

ConnectionTimeout

This property specifies the maximum amount of time that the Open() method can take to obtain a pooled connection before terminating the request.

Declaration
// C#
public int ConnectionTimeout {get;}
Property Value

The maximum time allowed for a pooled connection request, in seconds.

Implements

IDbConnection

Remarks

The default value is 15.

Setting this property to 0 allows the pooled connection request to wait for a free connection without a time limit. The timeout takes effect only for pooled connection requests and not for new connection requests.

See Also:

DataSource

This property specifies the Oracle Net Service Name (formerly known as TNS alias) that identifies an Oracle database instance.

Declaration
// C#
public string DataSource {get;}
Property Value

The Oracle Net Service Name.

Remarks

The default value of this property is an empty string

See Also:

ServerVersion

This property specifies the version number of the Oracle database to which the OracleConnection has established a connection.

Declaration
// C#
public string ServerVersion {get;}
Property Value

The version of the Oracle database, for example "9.2.0.1.0."

Exceptions

InvalidOperationException - The connection is closed.

Remarks

The default is an empty string.

See Also:

State

This property specifies the current state of the connection.

Declaration
// C#
public ConnectionState State {get;}
Property Value

The ConnectionState of the connection.

Implements

IDbConnection

Remarks

ODP.NET supports ConnectionState.Closed and ConnectionState.Open for this property. The default value is ConnectionState.Closed.

See Also:

OracleConnection Public Methods

OracleConnection public methods are listed in Table 4-28.

Table 4-28 OracleConnection Public Methods  
Public Method Description

BeginTransaction

Begins a local transaction (Overloaded)

ChangeDatabase

Not Supported

Clone

Creates a copy of an OracleConnection object

Close

Closes the database connection

CreateCommand

Creates and returns an OracleCommand object associated with the OracleConnection object

CreateObjRef

Inherited from MarshalByRefObject

Dispose

Inherited from Component

Equals

Inherited from Object (Overloaded)

GetHashCode

Inherited from Object

GetLifetimeService

Inherited from MarshalByRefObject

GetSessionInfo

Returns or refreshes the property values of the OracleGlobalization object that represents the globalization settings of the session (Overloaded)

GetType

Inherited from Object

InitializeLifetimeService

Inherited from MarshalByRefObject

Open

Opens a database connection with the property settings specified by the ConnectionString

OpenWithNewPassword

Opens a new connection with the new password

SetSessionInfo

Alters the session's globalization settings with the property values provided by the OracleGlobalization object

ToString

Inherited from Object

See Also:

BeginTransaction

BeginTransaction methods begin local transactions.

Overload List

BeginTransaction()

This method begins a local transaction.

Declaration
// C#
public OracleTransaction BeginTransaction();
Return Value

An OracleTransaction object representing the new transaction.

Implements

IDbConnection

Exceptions

InvalidOperationException - A transaction has already been started.

Remarks

The transaction is created with its isolation level set to its default value of IsolationLevel.ReadCommitted. All further operations related to the transaction must be performed on the returned OracleTransaction object.

See Also:

BeginTransaction(IsolationLevel)

This method begins a local transaction with the specified isolation level.

Declaration
// C#
public OracleTransaction BeginTransaction(IsolationLevel isolationLevel);
Parameters
Return Value

An OracleTransaction object representing the new transaction.

Implements

IDbConnection

Exceptions

InvalidOperationException - A transaction has already been started.

ArgumentException - The isolationLevel specified is invalid.

Remarks

The following two isolation levels are supported:

Requesting other isolation levels causes an exception.

Example
// C#
// Starts a transaction and inserts one record. If insert fails, rolls back
// the transaction. Otherwise, commits the transaction.

...
string ConStr = "User Id=myschema;Password=mypassword;" +
        "Data Source=oracle;";
OracleConnection con = new OracleConnection(ConStr);
con.Open();

//Create an OracleCommand object using the connection object
OracleCommand cmd = new OracleCommand("", con);

// Start a transaction
OracleTransaction txn = con.BeginTransaction(IsolationLevel.ReadCommitted);

try
{
   cmd.CommandText = "insert into mytable values (99, 'foo')";
   cmd.CommandType = CommandType.Text;
   cmd.ExecuteNonQuery();
   txn.Commit();
   Console.WriteLine("Both records are inserted into the database table.");
}
catch(Exception e)
{
   txn.Rollback();
   Console.WriteLine("Neither record was inserted into the database table.");
}
...

See Also:

Clone

This method creates a copy of an OracleConnection object.

Declaration
// C#
public object Clone();
Return Value

An OracleConnection object.

Implements

ICloneable

Remarks

The cloned object has the same property values as that of the object being cloned.

Example
// C#
...
OracleConnection con = new OracleConnection(ConStr);
con.Open();
...

//Need a proper casting for the return value when cloned
OracleConnection con_cloned = (OracleConnection) con.Clone();
...

See Also:

Close

This method closes the connection to the database.

Declaration
// C#
public void Close();
Implements

IDbConnection

Remarks

Performs the following:

The connection can be reopened using Open().

See Also:

CreateCommand

This method creates and returns an OracleCommand object associated with the OracleConnection object.

Declaration
// C#
public OracleCommand CreateCommand();
Return Value

The OracleCommand object.

Implements

IDbConnection

Example
// C#
//  Uses connection to create and return an OracleCommand object.

...
string ConStr = "User Id=myschema;Password=mypassword;" +
      "Data Source=oracle;";
OracleConnection con = new OracleConnection(ConStr);
con.Open();

OracleCommand cmd = Con.CreateCommand();

cmd.CommandText = "insert into mytable values (99, 'foo')";
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
...

See Also:

GetSessionInfo

GetSessionInfo returns or refreshes an OracleGlobalization object that represents the globalization settings of the session.

Overload List:

GetSessionInfo()

This method returns a new instance of the OracleGlobalization object that represents the globalization settings of the session.

Declaration
// C#
public OracleGlobalization GetSessionInfo();
Return Value

The newly created OracleGlobalization object.

Example
// C#
//  Retrieves the session globalization info and prints the language name.
//  Then sets new territory, language, and timestamp format into the session
//  globalization info in the connection object.

...
string ConStr = "User Id=myschema;Password=mypassword;" +
  "Data Source=oracle;";
OracleConnection con = new OracleConnection(ConStr);
con.Open();

...
//Get session info from connection object
OracleGlobalization ogi = con.GetSessionInfo();

//Print the language name
Console.WriteLine(ogi.Language);

//Update session info
oraGlob.Territory = "JAPAN";
ogi.Language = "JAPANESE";
ogi.TimeStampFormat = "HH.MI.SSXFF AM YYYY-MM-DD";

//Set session info into connection object
con.SetSessionInfo(ogi);
...

See Also:

GetSessionInfo(OracleGlobalization)

This method refreshes the provided OracleGlobalization object with the globalization settings of the session.

Declaration
// C#
public void GetSessionInfo(OracleGlobalization oraGlob);
Parameters

Open

This method opens a connection to an Oracle database.

Declaration
// C#
public void Open();
Implements

IDbConnection

Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The connection is already opened or the connection string is null or empty.

Remarks

The connection is obtained from the pool if connection pooling is enabled. Otherwise, a new connection is established.

It is possible that the pool does not contain any unused connections when the Open() method is invoked. In this case, a new connection is established.

If no connections are available within the specified connection timeout value, when the Max Pool Size is reached, an OracleException is thrown.

See Also:

OpenWithNewPassword

This method opens a new connection with the new password.

Declaration
// C#
public void OpenWithNewPassword(string newPassword);
Parameters
Remarks

This method uses the ConnectionString property settings to establish a new connection. The old password must be provided in the connection string as the Password attribute value.

This method can only be called on an OracleConnection in the closed state.

See Also:

SetSessionInfo

This method alters the session's globalization settings with all the property values specified in the provided OracleGlobalization object.

Declaration
// C#
public void SetSessionInfo(OracleGlobalization oraGlob);
Parameters

An OracleGlobalization object.

Remarks

Calling this method is equivalent to calling an ALTER SESSION SQL on the session.

Example
// C#

//  Retrieves the session globalization info and prints the language name.
//  Then sets new territory, language, and timestamp format into the session
//  globalization info in the connection object.

...
string ConStr = "User Id=myschema;Password=mypassword;" +
     "Data Source=oracle;";
OracleConnection con = new OracleConnection(ConStr);
con.Open();

//Create an OracleGlobalization object
OracleGlobalization ogi;

//Get session info using the second overloaded method
con.GetSessionInfo(ogi);

//Print the language name
Console.WriteLine(ogi.Language);

//Update session globalization info
oraGlob.Territory = "JAPAN";
ogi.Language = "JAPANESE";
ogi.TimeStampFormat = "HH.MI.SSXFF AM YYYY-MM-DD";

//Set session globalization info into connection object
con.SetSessionInfo(ogi);

See Also:

OracleConnection Events

OracleConnection events are listed in Table 4-29.

Table 4-29 OracleConnection Events  
Event Name Description

Disposed

Inherited from Component

Failover

An event that is triggered when an Oracle failover occurs

InfoMessage

An event that is triggered for any message or warning sent by the database

StateChange

An event that is triggered when the connection state changes

See Also:

Failover

This event is triggered when an Oracle failover occurs.

Declaration
// C#
public event OracleFailoverEventHandler Failover;
Event Data

The event handler receives an OracleFailoverEventArgs object which exposes the following properties containing information about the event.

InfoMessage

This event is triggered for any message or warning sent by the database.

Declaration
// C#
public event OracleInfoMessageEventHandler InfoMessage;
Event Data

The event handler receives an OracleInfoMessageEventArgs object which exposes the following properties containing information about the event.

Remarks

In order to respond to warnings and messages from the database, the client should create an OracleInfoMessageEventHandler delegate to listen to this event.

See Also:

StateChange

This event is triggered when the connection state changes.

Declaration
// C#
public event StateChangeEventHandler StateChange;
Event Data

The event handler receives a StateChangeEventArgs object which exposes the following properties containing information about the event.

Remarks

The StateChange event is raised after a connection changes state, whenever an explicit call is made to Open, Close or Dispose.

See Also:

OracleConnection Event Delegates

OracleConnection event delegates are listed in Table 4-30.

Table 4-30 OracleConnection Event Delegates  
Event Delegate Name Description

OracleFailoverEventHandler

An event delegate that handles the Failover event

OracleInfoMessageEventHandler

An event delegate that handles the InfoMessage event

StateChangeEventHandler

An event delegate that handles the StateChange event

OracleFailoverEventHandler

This event delegate handles the Failover event.

See Also:

OracleInfoMessageEventHandler

This event delegate handles the InfoMessage event.

See Also:

StateChangeEventHandler

This event delegate handles the StateChange event.

See Also:


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 2002, 2003 Oracle Corporation.

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