1

I was facing this issue. Hope someone could help me. The database has the following:

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 

For another part, I have the latest Visual Studio Enterprise 2017 - Version 15.9.7

When I do this simple code: Conex ok

Here is the code of the image:

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

Also, when I try this way.

Test conex-ok

However, When I try to connect with the new ODP. It fails.

ODP-FAILS

Here is the code of the image:

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

Also, If i try with the Visual Studio wizard is the same result.

Test conex-FAILS

To give extra information the versions of both DLL are:

According to dotPeek

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

For the other from nuget:

<package id="Oracle.ManagedDataAccess" version="18.3.0" targetFramework="net47" />
Jose Vf
  • 1,493
  • 17
  • 26
  • Please don't post pictures of your code or error messages. Make copy/paste of text. – Wernfried Domscheit Feb 20 '19 at 18:04
  • I think you mix several things. `Oracle.DataAccess.Client` and `Oracle.ManagedDataAccess.Client` and `OLE DB` provider are three different drivers. All of them need to be installed if you like to use them. If you use the full DB name like `Data Source=(DESCRIPTION = ...` then you don't need any `tnsnames.ora` file. If you compile your application with target .NET Framework 4.7 then you cannot use the `Oracle.DataAccess, Version=2.112.1.0`, you must use `Oracle.DataAccess, Version=4....` or change target .NET Framework to lower than 4.0 – Wernfried Domscheit Feb 20 '19 at 18:13
  • @WernfriedDomscheit I have 2 cases. Forgot the first one, I mean the picture when I can connect to DB. My doubt is why I'm not able to connect with **Oracle.ManagedDataAccess.Client** And Why Do I get that error? Since In the first case I can access with the same credentials but when I want to use **Oracle.ManagedDataAccess.Client** I can't. Thanks in advance – makubex1719 Feb 20 '19 at 19:32

0 Answers0