Oracle ODBC connection issue of “System.Exception: OCIEnvCreate failed with return code -1” on Windows with ASP

Days ago, I experienced technical issue while I set up the oracle ODBC connection for one of our third-party application which is required to get oracle database connection. This application is windows-based ASP.NET application sitting on Windows Server 2003.

To prepare the database connection, I installed Oracle Client software and created new TNS name pointing to target database with no problem. After setting the database connection within application, I was surprised getting the following error message while I tested via internet explorer.

System.Exception: OCIEnvCreate failed with return code -1 but error message text was not available.

I know it is because of no permissions to access oracle client while the connection was trying to create environment.  My quick search shows that there is one possible way to solve it by changing configuration file of Microsoft .Net Framework. But, that’s not my preferred way because any direct changing on very low level of system file could raise unexpected problem. Another method is to adjust permissions manually and it works to my situation.

Step 1: Log on Windows as a user with Administrator privileges

Step 2: Launch Windows Explorer from and navigate to the ORACLE_HOME folder. In my case, it’s installation path of Oracle Client Software.

Step 3: Right-click on the ORACLE_HOME folder and choose the “Properties” option

Step 4: Click on the “Security” tab of the “Properties” window

Step 5: Click on “Authenticated Users” item in the “Name” list

Step 6: Uncheck the “Read and Execute” box in the “Permissions for Administrators” list under the “Allow” column and then re-check the “Read and Execute” box under the “Allow” column (this is the box you just unchecked).

After doing that, the section “Permissions for Administrators” looks like below. In my case, above actions un-checked “Full Control” and “Modify” under the Allow” column.

Step 7: Click the “Advanced” button and in the “Permission Entries” list make
sure you see the “Authenticated Users” listed there with:
Permission = Read & Execute
Apply To = This folder, subfolders and files
If this is NOT the case, edit that line and make sure the “Apply onto”
drop-down box is set to “This folder, subfolders and files”.  This
should already be set properly but it is important that you verify this.

Step 8: Click “OK” button to apply the changes you made and then reboot your windows server.


Print Friendly, PDF & Email    Send article as PDF   
This entry was posted in Oracle Point and tagged . Bookmark the permalink.

10 Responses to Oracle ODBC connection issue of “System.Exception: OCIEnvCreate failed with return code -1” on Windows with ASP

  1. louis vuitton Monogram Multicolore says:

    Is it my web browser or the site, but I can only see part the post. How should I adjust this?

    • R.Wang says:

      I just got my blog upgraded to latest version of WordPress. Browsing with general Browsers should be fine now.

      Thanks for loving my blog.

  2. Lokesh Gopinath says:

    It works Excellent…

  3. Roger says:

    In line 5 you talk able Authenticated Users, in line 6 you talk about Administrators, line 7 it’s back to Authenticated Users, so is it Administrators or Authenticated Users?

  4. Rene Musters says:

    I have the problem on a windows7 desktop.

    tried to do same, but can only use deny (allows are greyed out). At one stage I had success, but shortly after, the error apeared again, without me changing aything in the environment.
    Can someone help me with instructions on a Windows7 platform.

    • R.Wang says:

      Didn’t get chance to verify this on Windows 7. But, it looked like you don’t have administrator privilege to work on that desktop.

  5. Suraj says:

    Wonderful!! it worked for me too.
    i found some of the possible cause for this exception is “Path” Environmental variable sometimes wont point to Oracle_Home directory.

    Make sure “Path” Environmental variable points to Oracle_Home directory. if not set it and restart IIS.

  6. Frederico Almeida says:

    Our problem was with a Webservice when connecting to an Oracle Database. When Invoking this error was get. However our machine doesnt have ASP and its a x64 machine. It wasnt a Privilege/Security problems but when configuring the IIS, we didnt enable the 32bits compability.

  7. tn says:

    That’s great, Thank you so much!

Leave a Reply

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