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

此生再无相见时 提交于 2019-12-01 12:51:06
Matt

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.

Basically in this case, System.Data.OracleClient need access to some of the oracle dll which are not part of .Net. Solutions:

  • Install Oracle Client , and add Oracle client bin location to Path environment varaible of windows OR
  • Copy oraociicus10.dll (Basic-Lite version) or aociei10.dll (Basic version), oci.dll, orannzsbb10.dll and oraocci10.dll from oracle client installable folder to bin folder of application so that application is able to find required dll
srinivas yelamanchili

"I have installed Oracle client version 10g on my PC" "System.Data.OracleClient requires Oracle client software version 8.1.7 or greater"

You are using Microsoft Oracle Client and the types in System.Data.OracleClient are depreciated in .NET Framework 4.0 and will be removed from future versions of .NET http://msdn.microsoft.com/en-us/library/77d8yct7.aspx

Check if you still have older Oracle Clients (8 or lower) on your computer. The PATH variable probably still points to the older Oracle client bin directory. If you run 'tnsping' from windows command line, and if you don't see the version 10, then it's still defaulted to the older.

Before you install newer Oracle Clients, it's always a good idea to first uninstall all existing oracle clients. And then install the highest version of oracle client supported by your Oracle Database server and your organization.

You may want to try Oracle Client 11g R2 and install the Oracle Data Providers for .NET http://www.oracle.com/technetwork/topics/dotnet/index-085163.html

If you are using .NET Framework 4.0 or higher, when you add reference to the Oracle.DataAccess in the Visual Studio Project, make sure that this dll is of 4.x.x.x, otherwise browse to your client location and pick the 4.x.x.x dll

The Oracle client software still needs to be installed on the client computer to allow connection to the Oracle database. The database user the SQL*Net which is the Oracle connectivity layer for Oracle database. The System.Data.OracleClient dll does not provide this function.

Download Oracle client software

You also must include a reference to the DLL when you compile your code. For example, if you are compiling a C# program, your command line should include:

like as:- csc /r:System.Data.OracleClient.dll

MSDN

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!