问题
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:
You are using an unsupported version of the Oracle Client (older than 11.2) on Windows 7.
DLLs from a previous installation of Oracle Client have been left on the system, causing a conflict.
The solutions:
Install a supported version of the Oracle Client.
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:
- Make sure NET MANAGER could connect to Oracle.
- mklink /D C:\Windows\System32\orcl
- mklink /D C:\Windows\SysWoW64\orcl
- set environment variable for ORACLE_HOME to C:\windows\system32\orcl
- add C:\windows\system32\orcl\bin to your PATH
- 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