C# – System.Data.OracleClient requires Oracle client software version 8.1.7 or greater

asp.netcoracleoracle10g

I have installed Oracle client version 10g on my PC(Registry ORACLE_BASE-D:\oracle\product\10.2.0).
I have added below references.
System.Data.OracleClient.

I am getting above mentioned error.
Below is the Code Snippet .

public static OracleConnection getConnection() 
{

    try 
    {
        dataSource = new SqlDataSource();
        dataSource.ConnectionString = System.Configuration.ConfigurationManager.AppSettings.Get("conn");
        OracleConnection connection = new OracleConnection();
        if (dataSource == null) 
        {
            // Error during initialization of InitialContext or Datasource
            throw new Exception("###### Fatal Exception ###### - DataSource is not initialized.Pls check the stdout/logs.");
        } 
        else
        {
            connection.ConnectionString = dataSource.ConnectionString;
            connection.Open();
        }
        return connection;            
    }catch (Exception ex) 
    {
        throw ex;
    }  

}

Please let me know what are the areas of Concern and where Iam missing.I am new for the combination of Oracle and Asp.Net.

Best Answer

It looks like you are using the Microsoft oracle client. I suggest that you use the ODP.net driver as it is much more reliable. (I believe the Microsoft client is being deprecated also?)

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

Install the ODP.net driver, add a reference to Oracle.DataAccess in your project, and you are good to go! Example code (from my previous post):

using System;
using System.Data;
using Oracle.DataAccess.Client;

static class Program
{
    [STAThread]
    static void Main()
    {
        TestOracle();
    }

    private static void TestOracle()
    {
        string connString = 
            "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)" + 
            "(HOST=servername)(PORT=‌​1521)))" +
            "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=servicename)));"+ 
            "User Id=username;Password=********;";
        using (OracleConnection conn = new OracleConnection(connString))
        {
            string sqlSelect = "SELECT * FROM TEST_TABLE";
            using (OracleDataAdapter da = new OracleDataAdapter(sqlSelect, conn))
            {
                var table = new DataTable();
                da.Fill(table);

                if (table.Rows.Count > 1) 
                    Console.WriteLine("Successfully read oracle.");
            }
        }
    }
}

EDIT: I also encountered the "requires Oracle client software version 8.1.7 or greater" error before. I was caused by installing the Oracle Client onto my computer. You may try uninstalling the Oracle Client (ironically) from your computer if you are set on using the Microsoft driver.