9

What's the 'new' way of establishing a OraConnection? Microsoft defines several classes as obsolete.

https://msdn.microsoft.com/en-us/library/system.data.oracleclient.aspx

I used to make use of something along those lines:

 string queryString = 
    "INSERT INTO Dept (DeptNo, Dname, Loc) values (50, 'TECHNOLOGY', 'DENVER')";
using (OracleConnection connection = new OracleConnection(connectionString))
{
    OracleCommand command = new OracleCommand(queryString);
    command.Connection = connection;
    try
    {
        connection.Open();
        command.ExecuteNonQuery();
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.Message);
    }

However all those Classes seem to be deprecated.

SighteD
  • 107
  • 1
  • 1
  • 10
  • They are obsolete now because Oracle has provided its own ADO.NET provider so there is no much sense for Microsoft to continue the development of these classes. Download the Oracle ADO.NET provider and use its classes (by the way I think they have pretty much the same name) – Steve Jun 09 '16 at 13:22
  • As a side note to the deprecated library....I think the ODP.Net supports tns-less connection strings. https://www.connectionstrings.com/oracle-provider-for-ole-db-oraoledb/tns-less-connection-string/ – granadaCoder Jun 09 '16 at 14:52

4 Answers4

6

Yes the System.Data.OracleClient is Obsolete.

Download the latest Oracle Client (ODP.Net) as per link below:

http://www.oracle.com/technetwork/topics/dotnet/index-085163.html

and reference the following namespace in your code

using Oracle.DataAccess.Client;
  • It works but when i start the console application i get 17 warnings: `Severity Code Description Project File Line Suppression State Warning CS0618 'OracleDataAdapter' is obsolete: 'OracleDataAdapter has been deprecated. http://go.microsoft.com/fwlink/?LinkID=144260' WindowsFormsApp1 ` – csandreas1 Dec 12 '18 at 10:50
0

It is still there in 4.5 but would be gone in the next release.

Quote:

Microsoft recommends that you use a third-party Oracle provider

Also see this answer: Third-Party Oracle Providers for .Net with object type support

Edit: Here's one: http://www.oracle.com/technetwork/topics/dotnet/index-085163.html

Community
  • 1
  • 1
Andre Haverdings
  • 797
  • 6
  • 10
0

The OracleClient was deprecated after .NET 4.0. You have several options now:

Oracle Data Provider for .NET (ODP.NET)

http://www.oracle.com/technetwork/topics/dotnet/index-085163.html

dotConnect for Oracle from DevArt

https://www.devart.com/dotconnect/oracle/

William Xifaras
  • 4,799
  • 2
  • 15
  • 19
0

You didn't mention it - but if you are coding in VS - Open your project in Solution Explorer, expand references and make sure System.Data.OracleClient is NOT listed, and Oracle.ManagedDataAccess IS listed.
If you've already installed ODT, you're done (for now).

Good Luck!

jmaschle
  • 41
  • 4