OracleClient的需要Oracle客户端软件版本8

OracleClient的需要Oracle客户端软件版本8

本文介绍了System.Data.OracleClient的需要Oracle客户端软件版本8.1.7或更高版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了Oracle客户端10g版本我的电脑上(注册ORACLE_BASE-D:\\ ORACLE \\产品\\ 10.2.0)。
我已经添加下面引用。
System.Data.OracleClient的。

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.

我收到上述的错误。
下面是code片段。

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

    }

请让我知道在哪里荫missing.I是新的Oracle和Asp.Net的组合关注和地区。

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.

推荐答案

它看起来像您使用Microsoft Oracle客户端。我建议你​​使用ODP.net驱动程序,因为它是更可靠。 (我相信微软客户端是德$ P $也pcated?)

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?)

安装驱动程序ODP.net,在你的项目中添加对Oracle.DataAccess的引用,你是好去!例如code(从我的$p$pvious帖子):

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

编辑:我也遇到了需要Oracle客户端软件版本8.1.7或更高版本错误之前。我是通过安装Oracle客户端到我的电脑引起的。您可以尝试从计算机中卸载Oracle客户端(讽刺)如果您在使用Microsoft驱动程序设置。

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.

这篇关于System.Data.OracleClient的需要Oracle客户端软件版本8.1.7或更高版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 13:10