3 Replies Latest reply: Oct 18, 2013 3:22 PM by Alex.Keh .Product.Manager-Oracle RSS

    ORA-12154: TNS:could not resolve the connect identifier specified

    efee9a8a-7e44-4b40-b032-453cd551f63b

      HI all,

      I am having an issue with connecting Oracle DB using tnsnames and ending up with the message "ORA-12154: TNS:could not resolve the connect identifier specified"

      I am trying to establish the connection from asp.net using framework 2.x. What I am trying to do is replace the drivers of oracle from 32 bit to 64 bit drivers. I am running my application on Windows 7 64 bit version (Enterprise Edition).

      When I suffix the host name to the DB name I am able to connect to the DB but I cannot do that as all applications in the organization is using just the dbname and rest of the information from tnsnames file.

      This issue is happening only from ASP.net applications. I am able to connect to the database when I wrote test application using winforms.

      Oracle driver version I am using is 2.112.3.0 (Oracle.DataAccess.dll). The server is Oracle 10g. Other applications such as TOAD and Oracle SQL Developer applications use the same tnsnames.ora and able to connect.

      Thank you in advance and look forward to hear from the community and any help is greatly appreciated.

      Mahidhar

        • 1. Re: ORA-12154: TNS:could not resolve the connect identifier specified
          Alex.Keh .Product.Manager-Oracle

          Assuming it's the same version of .NET Framework and ODP.NET, it's odd that a WinForm app can connect, but not an ASP.NET one.

           

          Is it possible you are using two different ODP.NET installations on your machine? The WinForm references one ODP.NET version in one Oracle Home and the ASP.NET references the same ODP.NET version, but in a different home. If that's the case, they would be using two different tnsnames files.

          • 2. Re: ORA-12154: TNS:could not resolve the connect identifier specified
            efee9a8a-7e44-4b40-b032-453cd551f63b

            HI Alex,

            Thank you for response.

            I have reviewed the possibility of winforms and asp.net using different versions but found to be using the same version. I made sure that only one valid reference to 2.112.3.0 dll in both applications (ASP and WinForm) but only winform working. MY tns entry is as below ( names changed due to confidentiality) but as I said, I am able to connect using TOAD and Oracle SQL Developer tool.

            ## Oracle - APP1 Development DB ######

            #####################################

            APP1.world =

              (DESCRIPTION =

                (ADDRESS_LIST =

                    (ADDRESS =

                      (PROTOCOL = TCP)

                      (Host = sunAPP1.ux.OrgName)

                      (Port = 1521)

                    )

                )

                (CONNECT_DATA =

                   (SID = APP1)

                   (GLOBAL_NAME = APP1.world)

                )

              )

            Hope this helps to understand my problem.

            • 3. Re: ORA-12154: TNS:could not resolve the connect identifier specified
              Alex.Keh .Product.Manager-Oracle

              Just so we're clear, verify that both the WinForm and ASP.NET are using the same installation of ODP.NET, not just the same version. It's possible to have two copies of the same version installed with each one having its own tnsnames file.

               

              If that's not the root cause, then I'm not sure what the problem is caused by.

               

              You can try replacing your ASP.NET "Data Source" attribute with entire TNS entry, such as

              "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=sunAPP1.ux.OrgName)(Port=1521)))(CONNECT_DATA=(SID=APP1)(GLOBAL_NAME=APP1.world)))".

               

              This makes sure you're referencing the network name that you truly intend to use.