5

I'm trying to study ORP.net and looking over this article on Deploying ODP.NET with Oracle Instant Client. I have downloaded and copied all DLLs in project as the article explains, however on the testing step, when the app is built I get the following error:

OCIEnvCreate failed with return code -1 but error message text was not available

I am using oraclexe and I have an Oracle client. I have given full permission for authenticated users. How can I solve this problem?

Robin James Kerrison
  • 1,727
  • 1
  • 15
  • 26
Nate
  • 827
  • 3
  • 18
  • 29

6 Answers6

6

When trying to connect to an Oracle database you receive the following error:

OCIEnvCreate failed with return code -1 but error message text was not available

The causes:

  1. You are using an unsupported version of the Oracle Client (older than 11.2) on Windows 7.

  2. DLLs from a previous installation of Oracle Client have been left on the system, causing a conflict.

The solutions:

  1. Install a supported version of the Oracle Client.

  2. Perform a search for "OCI.DLL" on the local machine. If you find any instances of this file in any location other than your ORACLE_HOME rename or delete it. If in doubt, uninstall the Oracle Client, then perform the search again. Anything that is leftover is the culprit.

Sirko
  • 72,589
  • 19
  • 149
  • 183
Santiago
  • 86
  • 1
  • 2
  • One more thing worth adding is that after re-installing be sure to recycle the ASP.net pool or you may continue to receive this error message. Took 30 minutes and 2 re-installs before I realized I needed to recycle the pool. – stoj Apr 09 '13 at 19:15
4

What worked for me was setting ORACLE_HOME to oracle\client\your_version\home1 instead of oracle\client\your_version\home1\BIN

MichaelS
  • 7,023
  • 10
  • 51
  • 75
0

Reinstalling Oracle and updating the ORACLE_HOME environment variable with the new installation folder worked for me. Don't forget to recycle your application pool before trying your application again.

jcs
  • 611
  • 2
  • 9
  • 22
0

I also had to make symbolic directory links for x86 and x64 applications. The steps I had to take were as follows:

  1. Make sure NET MANAGER could connect to Oracle.
  2. mklink /D C:\Windows\System32\orcl
  3. mklink /D C:\Windows\SysWoW64\orcl
  4. set environment variable for ORACLE_HOME to C:\windows\system32\orcl
  5. add C:\windows\system32\orcl\bin to your PATH
  6. It didn't work until after I restarted my computer
B2K
  • 2,541
  • 1
  • 22
  • 34
0

I also had the same issue when trying to connect Power BI to a Oracle database.

I had 2 versions of the Oracle client installed. 11.2 and 10.2. When I uninstalled the older version, it worked like a charm.

One thing to note is that in Power BI, when connecting to the oracle database it asked me to provide the server. But what is expects me to enter is the name of that connection in my tnsnames.ora file :)

0

In my case I have oracle client on the server but it was 64bit and the application run as 32bit.

Installing also 32bit (+add the folder to the path) fixed the problem.

s-s
  • 382
  • 2
  • 12