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)
- Try to download Oracle Client for Microsoft Windows (x64) through
- Install Instant Oracle Client x64.
- Install Oracle Data Provider.
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
- 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.
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
- Read BLOB data in Oracle DB In ASP.NET.
- Changing NLS_LANGUAGE Oracle Parameter via C# in ASP.NET
- Connect to Oracle DB from Visual Studio.
Have a Question?
If you have any related questions, please don’t hesitate to ask it at deBUG.to Community.
Pingback: Connect to Oracle DB on Visual Studio 2010 | Errors - Problems (SharePoint - ASP.Net - SQL Server .... etc)