OCIEnvCreate failed with return code -1 in Visual Studio

In this post, I will solve this error OCIEnvCreate failed with return code -1 that I encountered when tried to use Oracle Client NameSpace in SharePoint Solution in Visual Studio.


OCIEnvCreate failed with return code -1

When I tried to use oracle client to access oracle database in SharePoint Visual WebPart.  I got the following error

OCIEnvCreate failed with return code -1

I already have installed oracle client in my server, I also tried to create a new windows application and ASP.Net web application that use the same current installed oracle client dll and it has been worked properly. but it’s not worked in SharePoint Solution.

Cause

SharePoint solutions requires Oracle Client x64, and the current installed oracle client was 32 bit that is not supported with SharePoint.

Solution

Download Oracle Client for Windows (x64)

Install Oracle Data Provider

  • Open Command Prompt.(Run > cmd )
  • Navigate to Oracle Data Provider path at your local server then type
install.bat all c://Path of your installed client  then home name
OCIEnvCreate failed with return code -1 - Install Oracle Data Provider
  • Open Visual Studio > Solution Explorer > Right Click Add Reference > Browse the installed client path “C:\app\XXX\product\11.2.0\client_2\odp.net\bin\2.x
  • Select Orcale.DataAccess.dll.
  • Deploy the Visual WebPart that should be now deployed successfully.

Get the installed Oracle Client Path

  • Open Run > Type Regedit to open Registry Editor.
  • Navigate to LOCAL_MACHINE – SOFTWARE – ORACLE > The Oracle client’s home name.
oraclehome

Conclusion

In conclusion, we have learned the Oracle Client x32 bit is not supported with SharePoint solutions so you will get “OCIEnvCreate failed with return code -1”, and to solve this issue, you should use the Oracle Client x64.

Applies To
  • SharePoint.
  • Visual Studio.
  • Oracle Database.
You might also like to read
Have a Question?

If you have any related questions, please don’t hesitate to ask it at deBUG.to Community.

1 thought on “OCIEnvCreate failed with return code -1 in Visual Studio”

  1. Pingback: Connect to Oracle DB on Visual Studio 2010 | Errors - Problems (SharePoint - ASP.Net - SQL Server .... etc)

Leave a Reply

Scroll to Top