odp net conex失败,错误C#Visual Studio 2017 Oracle 11

时间:2019-02-20 16:04:46

标签: c# oracle visual-studio odp

我正面临这个问题。希望有人可以帮助我。 该数据库具有以下内容:

SELECT * FROM V$VERSION

BANNER  
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production  
PL/SQL Release 11.2.0.4.0 - Production  
CORE 11.2.0.4.0 Production  
TNS for IBM/AIX RISC System/6000: Version 11.2.0.4.0 - Production  
NLSRTL Version 11.2.0.4.0 - Production 

另一方面,我拥有最新的Visual Studio Enterprise 2017-版本15.9.7

当我执行以下简单代码时: Conex ok

这是图片的代码:

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


namespace ConexDapper
{
    class Program
    {
        static void Main(string[] args)
        {
            DateTime result = new DateTime();

            using (var conex = CreateConnection())
            {
                result = conex.Query<DateTime>("Select sysdate from dual", null, commandType: CommandType.Text).FirstOrDefault();
            }

            Console.WriteLine(result);
        }

        public static IDbConnection CreateConnection()
        {
            var provider = new OracleClientFactory();
            var conex = provider.CreateConnection();
            conex.ConnectionString = "Data Source=(DESCRIPTION =  (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = 99.999.999.999)(PORT = 1525)) ) (CONNECT_DATA = (SERVICE_NAME = url.url.com) ));User Id=fail;password=fail;";

            return conex;
        }
    }
}

此外,当我尝试这种方式时。

Test conex-ok

但是,当我尝试连接新的ODP时。它失败了。

ODP-FAILS

这是图片的代码:

using System;
using Oracle.ManagedDataAccess.Client;


namespace ConexDapper
{
    class Program
    {
        static void Main(string[] args)
        {
            string conexString = "Data Source=(DESCRIPTION =  (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = 99.999.999.999)(PORT = 1525)) ) (CONNECT_DATA = (SERVICE_NAME = URL.url.url) ));User Id=fails;password=fails;";
            var cn = new OracleConnection(conexString);

            cn.Open(); // FAILSSSSS
            Console.WriteLine("version --> " + cn.ServerVersion);
        }
    }
}

此外,如果我尝试使用Visual Studio向导,结果也是一样。

Test conex-FAILS

要提供更多信息,两个DLL的版本均为:

根据dotPeek

Oracle.DataAccess, Version=2.112.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342  

对于其他来自nuget的人:

<package id="Oracle.ManagedDataAccess" version="18.3.0" targetFramework="net47" />

0 个答案:

没有答案