locked
ORA-12504: TNS: listener was not given the Service_name in connect_data RRS feed

  • Question

  • User-73514677 posted

    Hi.

    I am trying to connect to Oracle Exadata 12 c database from a C# Web application ( VS2010).

    I have used the below code

    //web.config
    <add name="con" connectionString="DataSource=servername;userId=uid;password=pwd" providerName="Oracle.DataAccess.Client" />
    
    // c# cs code
    string oradb = System.Configuration.ConfigurationManager.ConnectionStrings["con"].ConnectionString;
    
    OracleConnection conn = new OracleConnection(oradb);
    conn.Open()
    
    

    I am getting the error: ORA-12504: TNS: listener was not given the Service_name in connect_data , when the Open connection is called.

    The tns entry has the below:

    t1_exa_abc=
    (DESCRIPTION=
    (ADDRESS=
    (PROTOCOL = TCP)
    (HOST=SERVERNAME)
    (PORT=port number)
    )
    (CONNECT_DATA=
    (SERVER=dedicated)
    (SERVICE_NAME=t1_exa_abc.domain.com)
    )
    )

    How to fix this?

    Monday, February 11, 2019 11:58 AM

All replies