Save Big on Cyber Monday! Up to 40% Off
ends in   {{days}}
Days
{{timeFormat.hours}}
:
{{timeFormat.minutes}}
:
{{timeFormat.seconds}}

Getting Started With dotConnect for Oracle

Below are some resources to help you maximize your experience with dotConnect for Oracle.

dotConnect for Oracle is a high-performance ADO.NET data provider with ORM support, offering fast and direct access to Oracle databases for application development.

  • Direct access to data without Oracle Client
  • ORM support: EF Core, Dapper, NHibernate, LinqConnect, etc.
  • Compatibility with different Oracle versions and .NET platforms
  • High performance with intelligent fetch block size control and batch processing
  • Robust security features, including advanced encryption and data integrity
  • Support for high-end Oracle features like RAC, sharding, and advanced queuing
  • Comprehensive support for Oracle-specific data types and PL/SQL
  • Integration with Visual Studio and design-time support

Code examples

using Devart.Data.Oracle;

class Program
{
  static void Main()
  {
    string connectionString = "" +
      "Server=127.0.0.1;" +
      "Port=1521;" +
      "User Id=TestUser;" +
      "Password=TestPassword;" +
      "Service Name=orcl;" +
      "Direct=True;" +
      "License Key=**********";

    using (OracleConnection connection = new OracleConnection(connectionString))
    {
      try
      {
        connection.Open();
        Console.WriteLine("Connection to Oracle successful!");
      }
      catch (Exception ex)
      {
        Console.WriteLine($"Error: {ex.Message}");
      }
    }
  }
}


                
PM> Install-Package Devart.Data.Oracle
using Devart.Data.Oracle;

class Program
{
  static void Main()
  {
    try
    {
      OracleConnectionStringBuilder oraCSB = new OracleConnectionStringBuilder();
      oraCSB.Server = "127.0.0.1";
      oraCSB.Port = 1521;
      oraCSB.ServiceName = "orcl";
      oraCSB.UserId = "TestUser";
      oraCSB.Password = "TestPassword";
      oraCSB.Direct = true;
      oraCSB.LicenseKey = "**********";

      using (OracleConnection connection = new OracleConnection(oraCSB.ConnectionString))
      {
        connection.Open();
         Console.WriteLine("Connection to Oracle successful!");
      }
    }
    catch (Exception ex)
    {
      Console.WriteLine($"Connection failed: {ex.Message}");
    }
  }
}
                            
PM> Install-Package Devart.Data.Oracle
using Devart.Data.Oracle;

class Program
{
  static void Main()
  {
    string connectionString = "" +
      "Direct=True;" +
      "Server=127.0.0.1;" +
      "Port=1521;" +
      "User Id=TestUser;" +
      "Password=TestPassword;" +
      "Service Name=orcl;" +
      "SslKey=/server.key;" +
      "SslCert=/server.crt;" +
      "SslVerification=False;" +
      "License Key=**********";

    using (OracleConnection connection = new OracleConnection(connectionString))
    {
      try
      {
        connection.Open();
        Console.WriteLine("SSL connection to Oracle successful!");
      }
      catch (Exception ex)
      {
        Console.WriteLine($"Error: {ex.Message}");
      }
    }
  }
}
PM> Install-Package Devart.Data.Oracle
using Devart.Data.Oracle;

class Program
{
  static void Main()
  {
    try
    {
      string connectionString =
        "Direct=True;" +
        "Host=ssh://127.0.0.1;" +
        "Port=1521;" +
        "Service Name=orcl;" +
        "User Id=TestUser;" +
        "Password=TestPassword;" +
        "License Key=**********";

      using (OracleConnection connection = new OracleConnection(connectionString))
      {
        // SSH tunnel setup
        connection.SshOptions.AuthenticationType = SshAuthenticationType.Password;
        connection.SshOptions.Host = "OracleSSH";
        connection.SshOptions.Port = 22;
        connection.SshOptions.User = "sshUser";
        connection.SshOptions.Password = "sshPassword";
        connection.Open();
        Console.WriteLine("SSH connection to Oracle established successfully!");
      }
    }
    catch (Exception ex)
    {
      Console.WriteLine($"Connection failed: {ex.Message}");
    }
  }
}
PM> Install-Package Devart.Data.Oracle

You can enable Unicode for any Oracle connection, whether it uses:

  • Plain TCP (Direct=True)
  • TNS (via Oracle Client)
  • SSL/TLS
  • Local database connections
using Devart.Data.Oracle;

class Program
{
  static void Main()
  {
    try
    {
      string connectionString =
        "Server=127.0.0.1;" +
        "Port=1521;" +
        "Service Name=orcl;" +
        "User Id=TestUser;" +
        "Password=TestPassword;" +
        "Direct=True;" +
        "License Key=**********";

      using (OracleConnection connection = new OracleConnection(connectionString))
      {
        connection.Open();
        connection.Unicode = true;
        Console.WriteLine("Connection with Unicode support established successfully!");
      }
    }
    catch (Exception ex)
    {
      Console.WriteLine($"Connection failed: {ex.Message}");
    }
  }
}
PM> Install-Package Devart.Data.Oracle
using Devart.Data.Oracle;

class Program
{
  static void Main()
  {
    string connectionString =
      "Server=127.0.0.1;" +
      "Port=1521;" +
      "Service Name=orcl;" +
      "User Id=TestUser;" +
      "Password=TestPassword;" +
      "Direct=True;" +
      "License Key=**********";

    using (OracleConnection connection = new OracleConnection(connectionString))
    {
      try
      {
        connection.Open();
        Console.WriteLine("Connection to Oracle successful!");

        // Define a query to select data from the ACTOR table
        string query = "SELECT ACTOR_ID, FIRST_NAME, LAST_NAME FROM ACTOR";

        // Create a command object
        using (OracleCommand command = new OracleCommand(query, connection))
        {
          // Execute the query and get a data reader
          using (OracleDataReader reader = command.ExecuteReader())
          {
            // Loop through the result set
            while (reader.Read())
            {
              // Access the data using column names or indices
              int actorId = reader.GetInt32(reader.GetOrdinal("ACTOR_ID"));
              string firstName = reader.GetString(reader.GetOrdinal("FIRST_NAME"));
              string lastName = reader.GetString(reader.GetOrdinal("LAST_NAME"));

              // Print the data to the console
              Console.WriteLine($"Actor ID: {actorId}, Name: {firstName} {lastName}");
            }
          }
        }
      }
      catch (Exception ex)
      {
        Console.WriteLine($"Error: {ex.Message}");
      }
    }
  }
}
PM> Install-Package Devart.Data.Oracle
using Microsoft.EntityFrameworkCore;
using Devart.Data.Oracle.EFCore;

public class Actor
{
  public int ActorId { get; set; }
  public string FirstName { get; set; }
  public string LastName { get; set; }
}

public class SakilaContext : DbContext
{
  public DbSet<Actor> Actors { get; set; }

  protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
  {
    optionsBuilder.UseOracle(
      "Server=127.0.0.1;" +
      "Port=1521;" +
      "Service Name=orcl;" +
      "User Id=TestUser;" +
      "Password=TestPassword;" +
      "Direct=True;" +
      "License Key=**********"
    );
  }

  protected override void OnModelCreating(ModelBuilder modelBuilder)
  {
    modelBuilder.Entity<Actor>().ToTable("ACTOR");
    modelBuilder.Entity<Actor>().HasKey(a => a.ActorId);
    modelBuilder.Entity<Actor>().Property(a => a.ActorId).HasColumnName("ACTOR_ID");
    modelBuilder.Entity<Actor>().Property(a => a.FirstName).HasColumnName("FIRST_NAME");
    modelBuilder.Entity<Actor>().Property(a => a.LastName).HasColumnName("LAST_NAME");
  }
}

class Program
{
  static void Main()
  {
    using (var context = new SakilaContext())
    {
      try
      {
        // Optional: Check connection and ensure mapping works
        Console.WriteLine("Connected to Oracle database via EF Core successfully!");

        var actors = context.Actors.Take(10);
        foreach (var actor in actors)
        {
          Console.WriteLine($"Actor ID: {actor.ActorId}, Name: {actor.FirstName} {actor.LastName}");
        }
      }
      catch (Exception ex)
      {
        Console.WriteLine($"Error: {ex.Message}");
      }
    }
  }
}
PM> Install-Package Devart.Data.Oracle.EFCore
using Devart.Data.Oracle;

class Program
{
  static void Main()
  {
    string connectionString =
      "Server=127.0.0.1;" +
      "Port=1521;" +
      "Service Name=orcl;" +
      "User Id=TestUser;" +
      "Password=TestPassword;" +
      "Direct=True;" +
      "License Key=**********";

    using (OracleConnection connection = new OracleConnection(connectionString))
    {
      try
      {
        connection.Open();
        Console.WriteLine("Connection to Oracle successful!");

        // Define a query to select data from the ACTOR table
        string query = "SELECT ACTOR_ID, FIRST_NAME, LAST_NAME FROM ACTOR";

        // Create a command object
        using (OracleCommand command = new OracleCommand(query, connection))
        {
          // Create a data adapter
          using (OracleDataAdapter adapter = new OracleDataAdapter(command))
          {
            // Create a DataTable to hold the data
            DataTable dataTable = new DataTable();

            // Fill the DataTable with data from the database
            adapter.Fill(dataTable);

            // Loop through the DataTable and print the data
            foreach (DataRow row in dataTable.Rows)
            {
              int actorId = Convert.ToInt32(row["ACTOR_ID"]);
              string firstName = row["FIRST_NAME"].ToString();
              string lastName = row["LAST_NAME"].ToString();

              Console.WriteLine($"Actor ID: {actorId}, Name: {firstName} {lastName}");
            }
          }
        }
      }
      catch (Exception ex)
      {
        Console.WriteLine($"Error: {ex.Message}");
      }
    }
  }
}

                            
PM> Install-Package Devart.Data.Oracle
using Devart.Data.Oracle;

class Program
{
  static void Main()
  {
    string connectionString =
      "Server=127.0.0.1;" +
      "Port=1521;" +
      "Service Name=orcl;" +
      "User Id=TestUser;" +
      "Password=TestPassword;" +
      "Direct=True;" +
      "License Key=**********";

    using (OracleConnection connection = new OracleConnection(connectionString))
    {
      try
      {
        connection.Open();
        Console.WriteLine("Connection to Oracle successful!");

        // Start a transaction
        using (OracleTransaction transaction = connection.BeginTransaction())
        {
          try
          {
            // Insert a new actor
            string insertQuery = "INSERT INTO ACTOR (FIRST_NAME, LAST_NAME) VALUES ('John', 'Doe')";
            using (OracleCommand insertCommand = new OracleCommand(insertQuery, connection, transaction))
            {
              insertCommand.ExecuteNonQuery();
              Console.WriteLine("Insert command executed.");
            }

            // Update the actor's last name
            string updateQuery = "UPDATE ACTOR SET LAST_NAME = 'Smith' WHERE FIRST_NAME = 'John' AND LAST_NAME = 'Doe'";
            using (OracleCommand updateCommand = new OracleCommand(updateQuery, connection, transaction))
            {
              updateCommand.ExecuteNonQuery();
              Console.WriteLine("Update command executed.");
            }

            // Commit the transaction
            transaction.Commit();
            Console.WriteLine("Transaction committed successfully.");
          }
          catch (Exception ex)
          {
            // Roll back the transaction on error
            transaction.Rollback();
            Console.WriteLine($"Transaction rolled back due to an error: {ex.Message}");
          }
        }
      }
      catch (Exception ex)
      {
        Console.WriteLine($"Connection error: {ex.Message}");
      }
    }
  }
}
PM> Install-Package Devart.Data.Oracle
using Devart.Data.Oracle;

class Program
{
  static void Main()
  {
    string connectionString =
      "Server=127.0.0.1;" +
      "Port=1521;" +
      "Service Name=orcl;" +
      "User Id=TestUser;" +
      "Password=TestPassword;" +
      "Direct=True;" +
      "License Key=**********";

    using (OracleConnection connection = new OracleConnection(connectionString))
    {
      try
      {
        connection.Open();
        Console.WriteLine("Connection to Oracle successful!");

        // Attempt to execute a query that may cause an exception
        string query = "SELECT * FROM NON_EXISTENT_TABLE";
        using (OracleCommand command = new OracleCommand(query, connection))
        {
          using (OracleDataReader reader = command.ExecuteReader())
          {
            while (reader.Read())
            {
              // This code won't be reached if the table doesn't exist
              Console.WriteLine(reader["COLUMN_NAME"]);
            }
          }
        }
      }
      catch (OracleException ex)
      {
        // Handle Oracle-specific exception
        Console.WriteLine($"Oracle Error: {ex.Message}");
        Console.WriteLine($"Error Code: {ex.Code}");
        Console.WriteLine($"Error Source: {ex.Source}");
        Console.WriteLine($"Stack Trace: {ex.StackTrace}");
      }
      catch (Exception ex)
      {
        // Handle general .NET exceptions
        Console.WriteLine($"General Error: {ex.Message}");
      }
    }
  }
}
PM> Install-Package Devart.Data.Oracle

Demo videos

How-to articles

.NET Oracle Connection String
Learn how to set up connection strings properly when working with dotConnect for Oracle in .NET applications.
Connect to Oracle in .NET
Explore how to establish a connection between .NET applications and an Oracle database using ADO.NET.
Connect to Oracle with EF Core
Find out how to connect an Oracle database to your application using EF Core and ADO.NET.
Connect to Oracle with Dapper
Learn how to connect C# to Oracle using Dapper for fast and efficient data access and management.
Connect to Oracle in Blazor
Learn how to integrate Oracle with .NET Blazor applications using EF Core and ADO.NET.
Connect to Oracle in MAUI
See how to build .NET MAUI applications and perform CRUD operations with Oracle using ADO.NET.
Connect to Oracle with NHibernate
Learn how to connect C# to Oracle using NHibernate for fast and efficient data access.
dotConnect for Oracle vs. ODP.NET
Find the best ODP.NET alternative for your Oracle-based projects.

Documentation

Licensing
Licensing
A detailed technical reference on embedding license information - a required resource for applications built with dotConnect for Oracle.
DataTable Features
DataTable features
A guide to using the OracleDataTable component and its features, like server connections, command objects, data storage, and data access.
Parameters
Parameters
An overview of SQL query parameters and their synchronization, along with practical insights into working with stored procedures.
Specific Features
Specific features
An explanation of support for Oracle-specific technologies, including secure connections, embedded servers, load balancing, and more.

dotConnect Universal

Get universal access to data from a variety of sources, including SQL Server, Oracle, PostgreSQL, MySQL, SQLite, DB2, InterBase, Microsoft Access, and Firebird. Other servers can be accessed through their ADO.NET, OLE DB and ODBC providers.

FAQ

What is the trial period for dotConnect for Oracle?
dotConnect for Oracle offers a fully functional 30-day trial. During this period, you can use and evaluate all features without limitations. After the trial ends, you can purchase a license to keep using the product.
Why do I need to install the product if NuGet is available?

dotConnect for Oracle provides two sets of assemblies, and the choice depends on your project type:

  • For .NET Framework projects: Use the Devart assemblies included with the product installer.
  • For .NET (.NET Core/.NET 5+) projects: Use the assemblies available via NuGet packages.
Where should I apply my License Key?

The method for applying your license depends on your project type:

  • For .NET (.NET Core/.NET 5+) projects, apply the License Key at runtime using the License Key connection string parameter.
  • For .NET Framework projects, no license key is needed. Simply download and install the licensed version of dotConnect from your Devart Customer Portal.
What editions of dotConnect for Oracle are available, and what's the difference?

There are five editions:

  • Express - Free version with basic connectivity.
  • Standard - Full ADO.NET provider with design-time support.
  • Professional - Adds ORM tools like Entity Framework and LinqConnect.
  • Developer - Includes all Professional features.
  • Mobile - Provides Standard features for the .NET Compact Framework.
Do end users of my application need a Devart license, or do I have to pay additional fees for deploying my software?

No, end users do not need a Devart license, and there are no additional deployment fees, as long as you hold a valid Devart license.

According to the EULA, you're allowed to redistribute the following runtime assemblies with your application:

  • Devart.Data.Oracle.dll
  • Devart.Data.dll

You can include them in your app's folder (such as Bin for web apps) or register them in the GAC. Just make sure they are only used by your solution.

There's no need for a full installation on the target machine, you can also use the "Minimal installation" option provided by the setup.

No other components of dotConnect may be distributed.

How can I upgrade dotConnect to a new version?

To upgrade dotConnect to a new version, you need to reinstall it:

  • 1. Open Settings > Apps > Installed apps in Windows.
  • 2. Uninstall the current and any older versions of dotConnect, including Entity Developer and LinqConnect, if installed.
  • 3. Visit the Customer Portal and download the latest licensed version.
  • 4. Install the downloaded version and receive the latest features and improvements.
How can I completely remove all previous versions of a product?

1. Go to Settings > Apps > Installed apps and uninstall:

  • All dotConnect providers
  • Entity Developer
  • LinqConnect

2. Manually delete any leftover files from the following locations (if they exist):

GAC folders:

  • C:\Windows\assembly\GAC_MSIL
  • C:\Windows\Microsoft.NET\assembly\GAC_MSIL

Program files and extensions:

  • C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\Devart
  • C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Devart
  • C:\Program Files (x86)\Devart
  • C:\Program Files\Devart
  • C:\Program Files (x86)\Common Files\Devart
  • C:\Program Files\Common Files\Devart

Program data folders:

  • C:\ProgramData\Devart\dotConnect
  • C:\ProgramData\Devart\Entity Developer
  • C:\ProgramData\Devart\EntityDeveloper

Removing these ensures a clean system and prevents conflicts during future installations.

Wield the full firepower of dotConnect for Oracle
Go with the advanced edition of dotConnect for Oracle and stay at the top of your game from day one!