OracleConnection Constructors

Definition

Initializes a new instance of the OracleConnection.

Overloads

OracleConnection()

Initializes a new instance of the OracleConnection.

OracleConnection(String)

Initializes a new instance of the OracleConnection class with the specified connection string.

OracleConnection()

Initializes a new instance of the OracleConnection.

public OracleConnection ();

Examples

The following example creates and opens an OracleConnection.

public void CreateOracleConnection()
{
    string connectionString = "Data Source=Oracle8i;Integrated Security=yes";
    using (OracleConnection connection = new OracleConnection(connectionString))
    {
        connection.Open();
        Console.WriteLine("ServerVersion: " + connection.ServerVersion
            + "\nDataSource: " + connection.DataSource);
    }
}

Applies to

.NET Framework 4.8.1 וגירסאות אחרות
מוצר גירסאות
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

OracleConnection(String)

Initializes a new instance of the OracleConnection class with the specified connection string.

public OracleConnection (string connectionString);

Parameters

connectionString
String

The connection used to open the database.

Examples

The following example creates and opens an OracleConnection.

public void CreateOracleConnection()
{
    string connectionString = "Data Source=Oracle8i;Integrated Security=yes";
    using (OracleConnection connection = new OracleConnection(connectionString))
    {
        connection.Open();
        Console.WriteLine("ServerVersion: " + connection.ServerVersion
            + "\nDataSource: " + connection.DataSource);
    }
}

Applies to

.NET Framework 4.8.1 וגירסאות אחרות
מוצר גירסאות
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1