Error while connecting to Oracle, TNS:listener does not currently know of service requested in connect descriptor ASP.NET

My problem is when I try to make a connection to an Oracle 9i database, when I put the connection string it marks me “TNS: listener does not currently know of service requested in connect descriptor” .
I found in a forum a similar error and says that the change the SERVICE_NAME for the SID, make the change but now it marks me that “INVALID USERNAME / PASSWORD; LOGON DENIED”.

This is the foro: Error While connecting to Oracle, TNS:listener does not currently know of service requested in connect descriptor

It is clear that I use this class for other connections to Oracle, but they are versions greater than 9i.

Could you help me with this problem.
This is part of the code where I made the connection.

using Oracle.ManagedDataAccess.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace InterfaceMonterrey.Models
{
public class Ora_Conexion_ADQUIS
{
    private OracleConnection cn { get; set; }

    public OracleConnection getConn()
    {
        if (cn == null)
        {
            //string conexion = System.Configuration.ConfigurationManager.AppSettings["CONEXION_ORACLE_ADQUIS"].ToString();
/*string conexion = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xxx.xx.xxx.x)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=xxx)));User Id = ABC; Password = and123;";*/
            string conexion = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xxx.xx.xxx.x)(PORT=1521))(CONNECT_DATA=(SID=xxx)));User Id = ABC; Password = and123;";
            cn = new OracleConnection(conexion);

        }
        return cn;
    }
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *