6 Replies Latest reply on Aug 13, 2013 8:16 PM by user4028623 Branched from an earlier discussion.

    Unable to resolve connect hostname


      I have installed 12C clien in my window 7 64 bit developer laptop. Following Alex's vedio presentation for managed code beta release, I can make my web service work successfully with Oracle 10g database. The I deployed the web service to window 2003 64 bits R2 server. The server has no managed code instalation but oracle 10g client. It has no issue to connect to Oracle server and database.

      I did  following.

      1: Has Oracle.ManagedDataAccess.ddl under web service bin directory.

      2: Have tnsnames.ora in the same folder as web.config


      No addtional set up and service works fine.


      But, I do have an issue for the same application in window XP develoer desktop. The machine has Oracle client 11 installed. No managed code installation. I have OracleDataAccess.dll copied to lib folder of the application and refrecne it from VS 2010 project of the web service. I then have the tnsnames.ora file in everywhere of the application, such as under bin, lib, application root, debug, release .. When I run, I got error:

      Oracle.ManagedDataAccess.Client.OracleException: Network Transport: Unable to resolve connect hostname ---> OracleInternal.Network.NetworkException: Network Transport: Unable to resolve connect hostname


      The issue seems that the app could not locate tns entry but don't know how to fix it.


      Alex, any recommendation to resolve this issue?

        • 1. Re: Unable to resolve connect hostname
          Alex Keh - Product Manager-Oracle

          Try putting the tnsnames.ora under the ORACLE_HOME/network/admin directory for unmanaged ODP.NET.

          • 2. Re: Unable to resolve connect hostname
            Alex Keh - Product Manager-Oracle

            One side note: The error you are getting is a managed code error. Make sure you are using unmanaged ODP.NET if that is what you are intending to use.

            • 3. Re: Unable to resolve connect hostname


              Thanks for your support.


              I actually want to use managed code. My impression is that, I don't need to install Managed code as long as I bundle managed dlls wth my application for deployment. Is this correct understanding? I actuall did this in my window 2003 server without install managed code and successfully connected to oracle server. Also this is what it does from the video presentation from you.


              The issue is from widow XP, one of my dev machine. I need to distribute my web service to this window XP for testing and it got issue mentioned above. I have managed dll Oracle.managedDataAccess.dll and tnsnames.ora in this deployment package. same as I did in window 2003 server. But this could not connect to oracle server. Please advise for what can do to resolve it. I have no issue to use unmanaged code.




              • 4. Re: Unable to resolve connect hostname

                I already have this tnsnames.ora in unmanaged code folder ORACLE_HOME/network/admin directory for unmanaged ODP.NET. I still got the same error.

                Any thought?

                • 5. Re: Unable to resolve connect hostname
                  Alex Keh - Product Manager-Oracle

                  One caveat: Managed ODP.NET is not supported on Windows XP (nor 2003). Now, there isn't anything technically I'm aware of that wouldn't allow managed ODP.NET to run fine on XP. It's just that Microsoft will desupport XP in the near future and we chose to focus our bug fixing and testing resources on newer Windows platforms.


                  I got mixed up when you said Oracle.DataAccess since that's an unamanged ODP.NET DLL.


                  In any case, all you need to do is put tnsnames.ora in you current working application directory and it should run fine. That would be your bin\debug directory in a VS project. If it's there, next thing to check is whether your tnsnames.ora file has valid entries. It can be somewhat difficult to eyeball whether you've got a valid entry unless you've worked with Oracle connect descriptors a lot in the past. The easiest way to check is just to copy the entire connect descriptor and insert it as the Data Source attribute in your connection string. For example:


                  "User Id=hr; Password=xxx; Data Source = (DESCRIPTION=(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = orcl)));"

                  • 6. Re: Unable to resolve connect hostname

                    Yes. Put connection string  into web.config works. But could not make it work in window XP if use tnsnames.ora. I have put this file on any folder I can, such as VS project root, bin, debug, etc. The tns entry is correct becsue if I switch to unmanaged code, the tns entry can be recognized. No clue so far why the tns entry in tnsnames.ora file in window XP could not work.


                    Thanks Alex for your help. If I found the cuase of this issue, will update this post.