The exception that is generated when a warning or error is returned by an Oracle database or the .NET Framework Data Provider for Oracle. This class cannot be inherited.
For a list of all members of this type, see OracleException Members.
System.Object
System.Exception
System.SystemException
System.Data.OracleClient.OracleException
[Visual Basic] <Serializable> NotInheritable Public Class OracleException Inherits SystemException [C#] [Serializable] public sealed class OracleException : SystemException [C++] [Serializable] public __gc __sealed class OracleException : public SystemException [JScript] public Serializable class OracleException extends SystemException
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.
This class is created whenever the OracleDataAdapter encounters a situation that it cannot handle.
If the severity of the error is too great, the server may close the OracleConnection. However, the user can reopen the connection and continue.
[Visual Basic, C#] The following example generates an OracleException due to a missing database, and then displays the exception.
[Visual Basic] Public Sub ShowOracleException() Dim myConnection As OracleConnection = _ New OracleConnection("Data Source=Oracle8i;Integrated Security=yes") Try myConnection.Open() Catch e As OracleException Dim errorMessage As String = "Code: " & e.Code & vbCrLf & _ "Message: " & e.Message Dim log As System.Diagnostics.EventLog = New System.Diagnostics.EventLog() log.Source = "My Application" log.WriteEntry(errorMessage) Console.WriteLine("An exception occurred. Please contact your system administrator.") End Try End Sub [C#] public void ShowOracleException() { OracleConnection myConnection = new OracleConnection("Data Source=Oracle8i;Integrated Security=yes"); try { myConnection.Open(); } catch (OracleException e) { string errorMessage = "Code: " + e.Code + "\n" + "Message: " + e.Message; System.Diagnostics.EventLog log = new System.Diagnostics.EventLog(); log.Source = "My Application"; log.WriteEntry(errorMessage); Console.WriteLine("An exception occurred. Please contact your system administrator."); } }
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button
in the upper-left corner of the page.
Namespace: System.Data.OracleClient
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: System.Data.Oracleclient (in System.Data.Oracleclient.dll)
OracleException Members | System.Data.OracleClient Namespace