System.Data.OracleClient 需要 Oracle 客户端软件版本 8.1.7 或更高版本

发布于 2024-12-11 11:10:52 字数 983 浏览 1 评论 0 原文

我已经在我的PC上安装了Oracle客户端版本10g(注册表ORACLE_BASE-D:\oracle\product\10.2.0)。 我添加了以下参考文献。 系统.数据.OracleClient。

我收到上述错误。 以下是代码片段。

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;
    }  

}

请让我知道我关注的领域是什么以及我缺少的地方。我对 Oracle 和 Asp.Net 的组合是新手。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

森林散布 2024-12-18 11:10:52

看来您使用的是 Microsoft oracle 客户端。我建议您使用 ODP.net 驱动程序,因为它更可靠。 (我相信 Microsoft 客户端也已被弃用?)

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

安装ODP.net驱动程序,在项目中添加对Oracle.DataAccess的引用,然后就可以了 去!示例代码(来自我的 上一篇帖子):

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.");
            }
        }
    }
}

编辑:我之前也遇到过“需要 Oracle 客户端软件版本 8.1.7 或更高版本”错误。我的问题是因为我的电脑上安装了Oracle客户端。如果您打算使用 Microsoft 驱动程序,您可以尝试从计算机上卸载 Oracle 客户端(讽刺的是)。

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.

○愚か者の日 2024-12-18 11:10:52

基本上在这种情况下,System.Data.OracleClient需要访问一些不属于.Net的oracle dll。解决方案:

  • 安装Oracle客户端,并将Oracle客户端bin位置添加到windows的Path环境变量中
  • 复制
    oraociicus10.dll(Basic-Lite 版本)或 aociei10.dll(Basic 版本),
    将 oci.dll、orannzsbb10.dll 和 oraocci10.dll 从 oracle 客户端可安装文件夹复制到应用程序的 bin 文件夹中,以便应用程序能够找到所需的 dll

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
手心的温暖 2024-12-18 11:10:52

“我已经在我的PC上安装了Oracle客户端版本10g”
“System.Data.OracleClient 需要 Oracle 客户端软件版本 8.1.7 或更高版本”

您正在使用 Microsoft Oracle 客户端,并且 System.Data.OracleClient 中的类型在 .NET Framework 4.0 中已弃用并将被删除
来自 .NET 的未来版本
http://msdn.microsoft.com/en-us/library/77d8yct7.aspx

检查您的计算机上是否仍有较旧的 Oracle 客户端(8 或更低版本)。 PATH 变量可能仍然指向旧的 Oracle 客户端 bin 目录。
如果您从 Windows 命令行运行“tnsping”,并且没有看到版本 10,则它仍然默认为较旧的版本。

在安装较新的 Oracle 客户端之前,最好先卸载所有现有的 Oracle 客户端。
然后安装您的 Oracle 数据库服务器和您的组织支持的最高版本的 oracle 客户端。

您可能想尝试 Oracle Client 11g R2 并安装 Oracle Data Providers for .NET
http://www.oracle.com/technetwork/topics/dotnet/index -085163.html

如果您使用的是 .NET Framework 4.0 或更高版本,当您在 Visual Studio 项目中添加对 Oracle.DataAccess 的引用时,
确保此 dll 是 4.xxx,否则浏览到您的客户端位置并选择 4.xxx dll

"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

离线来电— 2024-12-18 11:10:52

客户端计算机上仍需要安装 Oracle 客户端软件才能连接到 Oracle 数据库。数据库用户 SQL*Net,它是 Oracle 数据库的 Oracle 连接层。 System.Data.OracleClient dll 不提供此函数。

下载 Oracle 客户端软件

编译你的代码。例如,如果您正在编译 C# 程序,则命令行应包括:

如:- csc /r:System.Data.OracleClient.dll

MSDN

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文