asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

Last post 11-21-2008 10:48 AM by mcf2020. 31 replies.

Sort Posts:

  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    04-05-2007, 7:20 AM

    Can you check how many oracle homes you have on the webserver?

    They should be listed under the following registry key 

    HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE

    Regards,
    Prashant


    Dont forget to click "Mark as Answer" on the post that helped you.
  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    04-05-2007, 9:34 AM
    • Participant
      1,161 point Participant
    • PTEKelly
    • Member since 12-20-2002, 3:54 AM
    • Manchester, England
    • Posts 251

    I may be leading you the wrong way but worth a look.

    if your database is on another server from the IIS server then you may need to look into impersonation settings in your web.config - had a similare issue but dont have access to the particular config at the moment so cant help with the details

    Paul

    "When all is said and done, there is usually more said than done." Alfred E Newman
  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    04-05-2007, 10:12 AM
    • Member
      295 point Member
    • aidoco
    • Member since 06-05-2006, 9:40 PM
    • Posts 84

    Hi Prashant,

    Thanks again for the prompt response. 

    In registry  under Oracle I have 2 Keys "KEY_XEClient and "OracleMTSRecoveryService"

    In KEY_XEClient the following are set
    ...
    ORACLE_HOME is set as "C:\XEClient" 

    ORACLE _HOME_KEY is "SOFTWARE\ORACLE\KEY_XEClient" ,
    ORACLE_BASE is "C:\XEClient"
    ORACLE_HOME_NAME is XEClient
    ... 

    I think you might have found a problem !! , I  thought the path would be C:\InstantClient

    In my enviroment variables I have the following System variables Path variable "C:\XEClient\bin"..."C:\instantClient"

    SQLPATH "C:\XEClient\sqlplus"

    I also have the user varaible TNS_ADMIN "C:\instantClient\InstantClient10_1"
     

    Should I update the enviroment variable to be  C:\XEClient\sqlplus

    Thank you again Praschant  for the help.

    Aidan
     

    AiDo
  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    04-05-2007, 10:30 AM
    • Member
      295 point Member
    • aidoco
    • Member since 06-05-2006, 9:40 PM
    • Posts 84

    Hi PTEKelly

     

    I have <identity impersonate="true" /> in the web.config and I *believe* I have the correct permission for teh ASPNET user on teh appropriate folders

    I'm still getting the ORA-12154 error . Any thought on other attributes I'd need for impersonation in teh web.config

    Thanks , any help is much appreciated 

     

    Aidan 

    AiDo
  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    04-05-2007, 8:29 PM

    Try first with giving rights to "NetworkService" on the folder and its subfolders.

    And then restart the machine if possible. 

    Regards,
    Prashant


    Dont forget to click "Mark as Answer" on the post that helped you.
  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    11-06-2007, 1:12 PM
    • Member
      2 point Member
    • ORA-12154
    • Member since 11-06-2007, 5:24 PM
    • Posts 1

    Platform: WindowsXP sp2 / Visual Studio 2003 / .net Framework v1.1.4322 / Oracle 8.1.7.4

    After uninstalling and reinstalling oracle 8.1.7.4, I kept getting stubborn "ORA-12154 :TNS:could not resolve the connect identifier specified" from ASP.net app.

    I was unable to assign read & execute on my c:\oracle folder to my IUSR_computer account.  Turns out my PC had been renamed before I took possession of it.  IIS properties tab indicated it was using IUSR_OLDcomputer instead of IUSR_CURRENTcomputer.

    Adding read & execute on c:\oracle for IUSR_OLDcomputer finally solved ORA-12154.

    These permissions are standard fix for ORA-12154 but the OLDcomputer name was a twist not mentioned among all the posts I've read.  Thought I'd share.

    Filed under: , ,
  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    11-06-2007, 2:24 PM
    • Participant
      891 point Participant
    • mfouwaaz
    • Member since 10-03-2007, 6:43 PM
    • Vancouver, Canada
    • Posts 265

    Hi

    Go to the Oracle Home / Admin / Network folder and look at the tnsnames.ora file.  Your database connection string should match the SID stated in the file.

     Hope this helps

     Fouwaaz

    Somewhere, something incredible is waiting to be known -- Carl Sagan
  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    05-12-2008, 12:53 PM
    • Member
      11 point Member
    • tawright915
    • Member since 04-17-2006, 10:05 PM
    • Posts 16

    did you ever get this to work?  I too wrote an app that access an Oracle DB on another server.  I get the same error.  I've tried everything that is mentioned on this page.  Any suggestions would be appreciated.

     

    Thanks

    Tom

  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    05-12-2008, 3:56 PM
    • Participant
      891 point Participant
    • mfouwaaz
    • Member since 10-03-2007, 6:43 PM
    • Vancouver, Canada
    • Posts 265

    Could you post the tnsnames.ora file (Oracle Home / Admin / Network) and the connection string?  That way, we'll be able to get a better idea.

    Somewhere, something incredible is waiting to be known -- Carl Sagan
  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    05-30-2008, 6:33 PM
    • Member
      6 point Member
    • tomwinans
    • Member since 05-30-2008, 10:21 PM
    • Posts 3

    I, too, have run into the same problem.

    My scenario is as follows:

    - Win 2008
    - Oracle 11g
    - IIS 7.0, configured to manage .svc-styled web services

    Oracle connectivity has been tested through a standard ODP client - successfully.
    tnsping shows the tnsnames.ora is properly constructed, and that it is reachable through ORACLE_HOME. SERVICE_NAME (not SID) is used in the CONNECT_DATA section.
    Permissions on ORACLE_HOME has been granted to Network Service.

    My Web Service method gets the 12154 error and I am at a loss as to why. I can debug into the service method and the connection.Open() method throws an exception when the connection string is identical to the one that was used in the simple database client.

    I have seen this same code work in IIS 6. As IIS 7 does not use the same configuration commands as IIS 6, I am wondering if my flavor of this dilemma could be attributable to IIS 7 config.

     Any insights into the problem would be welcomed.

    Thanks

  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    06-01-2008, 6:03 AM
    • Member
      6 point Member
    • tomwinans
    • Member since 05-30-2008, 10:21 PM
    • Posts 3
    I have gotten by this problem by ensuring IUSR_ComputerName, NETWORK SERVICE, ASPNET, and IIS_IUSRS have read access to %ORACLE_HOME%\Network\Admin\TNSNAMES.ORA. Of these, I think the anonymous user and NETWORK SERVICE are the more critical. However, I made sure all of them had access. Rebooting after setting access is important.
  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    06-01-2008, 6:27 AM
    • Member
      6 point Member
    • tomwinans
    • Member since 05-30-2008, 10:21 PM
    • Posts 3
    I am somewhat shooting in the dark here because I have not narrowed down the cause of my problem to my satisfaction ... I've been hunting for possibilities and believe that my problem was an access problem, and yours may be as well. Ensure that your ORACLE_HOME environment variable is properly defined ... this Oracle error signals some problem accessing ORACLE_HOME and the TNSNAMES.ORA file - so it may point to the fact that your ORACLE_HOME is not pointing to the proper location. To ensure that your TNSNAMES.ORA file is properly structured and you can access it, see if you can tnsping your database. If you cannot, then your TNSNAMES.ORA is either not structured correctly, or you cannot access it. Trying to use sqlplus will also tell you the file is structured right and is accessible. If you can do the above, your problem is most likely an IIS user permission issue. You might try to check out the IIS logs to see which user is trying to access the TNS...ORA file to ensure this user has permissions. IIS authentication method could also be an issue ... you might look into this. Ensure NETWORK SERVICE and IUSR_ComputerName have at least read access to %ORACLE_HOME%\Network\Admin and to the TNSNAMES.ORA in this folder (I assume you have a standard Oracle location for ORACLE_HOME). Ensure your connection string in your app or web config is proper ... and make sure that you are using Oracle's data provider rather than Microsoft's - probably not necessary to resolve an access problem, but it cannot hurt.
  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    06-05-2008, 12:14 PM

    http://www.techonthenet.com/oracle/errors/ora12154.php

     

    Does this help at all? 

  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    06-10-2008, 4:38 PM
    • Member
      8 point Member
    • thiboli
    • Member since 06-10-2008, 8:26 PM
    • Posts 4

    One more addition to this thread: I was facing the same error and tried all of the above. I was running a VB.net application as the administrator of the domain, so access was unlikely to be the problem.

    Eventually what appeared to be the root-cause of my problem was the fact that I was running the application on a 64 bit machine and had installed my application in the wrong directory.

    I had already installed the 10g oracle client for 64bit for which an earlier error had warned me. However, from that moment on ORA-12154 kept appearing, indicating a communication problem between the application and the Oracle-client.

    • TNSPing referred to the correct directory, the connection test worked properly.
    • An ODBC connection using the client worked properly, but as soon as I used this through my application using System.Data.ODBC, I had the same problem again.

    In the end I moved my application from C:\Program Files (x86) to C:\ProgramFiles and this solved it for me

  • Re: asp.net to oracle application produces error ORA-12154 :TNS:could not resolve the connect identifier specified

    07-15-2008, 10:54 AM
    • Member
      6 point Member
    • Michal Gorski
    • Member since 07-03-2008, 9:24 AM
    • Posts 3

    Hi, guys,

    I had the same problem, and I found a workaround- maybe someone will use as I use it.

     

    So, I think the problem is with access to tnsnames.ora or sqlnet.ora, because when you run your app in VS Developement Server it runs under your account's right (or user who ran the devenv.exe proccess) and everything is OK (or when you run sql plus, sql developer everything looks the same), when you run under IIS it runs with ASPNET account and its rights which are insufficient  for  these files

    To workaround  you can change  or  add  xml node to your web.config or  machine.config. The node should be under  <system.web> section, the node should look like:

     <identity impersonate="true" userName="yourWindowsAccountName" password="appropriatePassword" />

     

    Have fun, if betters ideas let as all know! Thx 

Page 2 of 3 (32 items) < Previous 1 2 3 Next >