Oracle® Data Provider for .NET Developer's Guide 11g Release 2 (11.2.0.3) Part Number E23174-02 |
|
|
PDF · Mobi · ePub |
An OracleClientFactory
object allows applications to instantiate ODP.NET classes in a generic way.
Supported Only in ADO.NET 2.0-Compliant ODP.NET
System.Object
System.Data.Common.DbProviderFactory
Oracle.DataAccess.Client.OracleClientFactory
// C# public sealed class OracleClientFactory : DbProviderFactory
All public static methods are thread-safe, although instance methods do not guarantee thread safety.
// C# using System; using System.Data; using System.Data.Common; using Oracle.DataAccess.Client; class FactorySample { static void Main() { string constr = "user id=scott;password=tiger;data source=oracle"; DbProviderFactory factory = DbProviderFactories.GetFactory("Oracle.DataAccess.Client"); DbConnection conn = factory.CreateConnection(); try { conn.ConnectionString = constr; conn.Open(); DbCommand cmd = factory.CreateCommand(); cmd.Connection = conn; cmd.CommandText = "select * from emp"; DbDataReader reader = cmd.ExecuteReader(); while (reader.Read()) Console.WriteLine(reader["EMPNO"] + " : " + reader["ENAME"]); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); } } }
Namespace: Oracle.DataAccess.Client
Assembly: Oracle.DataAccess.dll
ODP.NET Version: ODP.NET for .NET Framework 2.0 or ODP.NET for .NET Framework 4
See Also:
OracleClientFactory
members are listed in the following tables.
OracleClientFactory Public Properties
The OracleClientFactory
public properties are listed in Table 7-1.
Table 7-1 OracleClientFactory Public Properties
Property | Description |
---|---|
Indicates whether or not the |
OracleClientFactory Public Methods
OracleClientFactory
Public Methods are listed in Table 7-2.
Table 7-2 OracleClientFactory Public Method
Method | Description |
---|---|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a |
The OracleClientFactory
public properties are listed in Table 7-3.
Table 7-3 OracleClientFactory Public Properties
Property | Description |
---|---|
Indicates whether or not the |
See Also:
This property indicates whether or not the CreateDataSourceEnumerator
method is supported.
// C# public override bool CanCreateDataSourceEnumerator { get; }
Returns true
.
ODP.NET supports the OracleDataSourceEnumerator
object.
See Also:
The OracleClientFactory
public method is listed in Table 7-4.
Table 7-4 OracleClientFactory Public Method
Method | Description |
---|---|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a |
See Also:
This method returns a DbCommand
object that represents an OracleCommand
object.
// C# public override DbCommand CreateCommand();
A DbCommand
object that represents an OracleCommand
object.
See Also:
This method returns a DbCommandBuilder
object that represents an OracleCommandBuilder
object.
// C# public override DbCommandBuilder CreateCommandBuilder();
A DbCommandBuilder
object that represents an OracleCommandBuilder
object.
See Also:
This method returns a DbConnection
object that represents an OracleConnection
object.
// C# public override DbConnection CreateConnection();
A DbConnection
object that represents an OracleConnection
object.
See Also:
This method returns a DbConnectionStringBuilder
object that represents an OracleConnectionStringBuilder
object.
// C# public override DbConnectionStringBuilder CreateConnectionStringBuilder();
A DbConnectionStringBuilder
object that represents an OracleConnectionStringBuilder
object.
See Also:
This method returns a DbDataAdapter
object that represents an OracleDataAdapter
object.
// C# public override DbDataAdapter CreateDataAdapter();
A DbDataAdapter
object that represents an OracleDataAdapter
object.
See Also:
This method returns a DbDataSourceEnumerator
object that represents an OracleDataSourceEnumerator
object.
// C# public override DbDataSourceEnumerator CreateDataSourceEnumerator();
A DbDataSourceEnumerator
object that represents an OracleDataSourceEnumerator
object.
See Also:
This method returns a DbParameter
object that represents an OracleParameter
object.
// C# public override DbParameter CreateParameter();
A DbParameter
object that represents an OracleParameter
object.
See Also:
This method returns a CodeAccessPermission
object that represents an OraclePermission
object.
// C#
public override System.Security.CodeAccessPermission CreatePermission(
System.Security.Permissions.PermissionState state);
state
A PermissionState
object.
A CodeAccessPermission
object that represents an OraclePermission
object.
This method enables users, writing provider-independent code, to get a CodeAccessPermission
instance that represents an OraclePermission
object.