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

对着背影说爱祢 提交于 2019-12-23 18:51:24

问题


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?


回答1:


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.




回答2:


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




回答3:


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.




回答4:


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



回答5:


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 :)



来源:https://stackoverflow.com/questions/12901045/ocienvcreate-failed-with-return-code-1-but-error-message-text-was-not-available

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!