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

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 t...

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's user avatar

asked Oct 15, 2012 at 17:39

Nate's user avatar

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's user avatar

Sirko

71.4k19 gold badges146 silver badges180 bronze badges

answered Jan 4, 2013 at 15:03

Santiago's user avatar

SantiagoSantiago

861 silver badge2 bronze badges

1

What worked for me was setting ORACLE_HOME to oracleclientyour_versionhome1 instead of oracleclientyour_versionhome1BIN

answered Apr 26, 2017 at 8:56

MichaelS's user avatar

MichaelSMichaelS

6,92310 gold badges49 silver badges73 bronze badges

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.

answered Jun 11, 2015 at 17:20

jcs's user avatar

jcsjcs

6112 gold badges11 silver badges21 bronze badges

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:WindowsSystem32orcl
  3. mklink /D C:WindowsSysWoW64orcl
  4. set environment variable for ORACLE_HOME to C:windowssystem32orcl
  5. add C:windowssystem32orclbin to your PATH
  6. It didn’t work until after I restarted my computer

answered Feb 8, 2018 at 15:53

B2K's user avatar

B2KB2K

2,5211 gold badge21 silver badges34 bronze badges

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

answered May 9, 2018 at 8:36

Charlie's user avatar

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.

answered Jan 12 at 14:56

s-s's user avatar

s-ss-s

2822 silver badges12 bronze badges

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's user avatar

asked Oct 15, 2012 at 17:39

Nate's user avatar

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's user avatar

Sirko

71.4k19 gold badges146 silver badges180 bronze badges

answered Jan 4, 2013 at 15:03

Santiago's user avatar

SantiagoSantiago

861 silver badge2 bronze badges

1

What worked for me was setting ORACLE_HOME to oracleclientyour_versionhome1 instead of oracleclientyour_versionhome1BIN

answered Apr 26, 2017 at 8:56

MichaelS's user avatar

MichaelSMichaelS

6,92310 gold badges49 silver badges73 bronze badges

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.

answered Jun 11, 2015 at 17:20

jcs's user avatar

jcsjcs

6112 gold badges11 silver badges21 bronze badges

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:WindowsSystem32orcl
  3. mklink /D C:WindowsSysWoW64orcl
  4. set environment variable for ORACLE_HOME to C:windowssystem32orcl
  5. add C:windowssystem32orclbin to your PATH
  6. It didn’t work until after I restarted my computer

answered Feb 8, 2018 at 15:53

B2K's user avatar

B2KB2K

2,5211 gold badge21 silver badges34 bronze badges

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

answered May 9, 2018 at 8:36

Charlie's user avatar

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.

answered Jan 12 at 14:56

s-s's user avatar

s-ss-s

2822 silver badges12 bronze badges

User-1077881737 posted

Hi,

We have a requirement to connect to oracle from ASP.NET and we installed ODAC(ODAC1110621) components  on the server but still we are getting the following error while opening the connection. Please find the details below:-

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

Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: OCIEnvCreate failed with return code -1 but error message text was not available.

Source Error:

Line 16:     {
Line 17:         OracleConnection con = new OracleConnection(ConfigurationManager.ConnectionStrings["HRDBA"].ConnectionString);
Line 18:         con.Open();
Line 19:         Label1.Text = con.State.ToString();
Line 20:         con.Close();

Source File: \hs003fs01-02.homebase.comwfmpWebpage1.aspx.cs    Line:
18

Stack Trace:

[Exception: OCIEnvCreate failed with return code -1 but error message text was not available.]
   System.Data.OracleClient.OciHandle..ctor(OciHandle parentHandle, HTYPE handleType, MODE ocimode, HANDLEFLAG handleflags) +376
   System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName) +151
   System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString connectionOptions) +133
   System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +40
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +29
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +433
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +72
   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +457
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +100
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +116
   System.Data.OracleClient.OracleConnection.Open() +40
   Webpage1.Page_Load(Object sender, EventArgs e) in \hs003fs01-02.homebase.comwfmpWebpage1.aspx.cs:18
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627


I would be greteful if you could please suggest how i can fix this. The user is having full permissions on the Oracle folder.

Many Thanks,

Madhu

<!— [Exception]: OCIEnvCreate failed with return code -1 but error message text was not available. at System.Data.OracleClient.OciHandle..ctor(OciHandle parentHandle, HTYPE handleType, MODE ocimode, HANDLEFLAG handleflags) at System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String
userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName) at System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString connectionOptions) at System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection
owningObject) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.OracleClient.OracleConnection.Open() at Webpage1.Page_Load(Object sender, EventArgs e) in \hs003fs01-02.homebase.comwfmpWebpage1.aspx.cs:line
18 at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) [HttpUnhandledException]: Exception of type ‘System.Web.HttpUnhandledException’ was thrown. at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.webpage1_aspx.ProcessRequest(HttpContext context) in c:WINDOWSMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Filesroot7971936fa687e91App_Web_vnm9shij.2.cs:line
0 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) —>

Hello,

I am new using the Oracle Data Access components.  My company 32-bit .NET 4.0 VB.NET application uses the ODAC 12c libraries and it runs for an 2 plus hours and then crashes with the following:

Exception Level 1: Execption Type: Exception Exception Level 1: Error Description: OCIEnvCreate failed with return code -1 but error message text was not available.

Exception Level 1: Source:System.Data.OracleClient

Exception Level 1: Stack Trace:   at System.Data.OracleClient.OciHandle..ctor(OciHandle parentHandle, HTYPE handleType, MODE ocimode, HANDLEFLAG handleflags)

1:    at System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName)

1:    at System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString connectionOptions)

1:    at System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)

1:    at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)

1:    at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)

1:    at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)

1:    at System.Data.OracleClient.OracleConnection.Open()

1:    at Microsoft.Practices.EnterpriseLibrary.Data.Database.GetNewOpenConnection()

1:    at Microsoft.Practices.EnterpriseLibrary.Data.Database.GetWrappedConnection()

1:    at Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteNonQuery(DbCommand command)

1:    at USG.LinX.PrintAndApply.DataObjects.OracleDataProvider.LogEvent(String msg, String MessageType, String OrgCode, Nullable`1 LineNumber, Char LegLetter, Nullable`1 StackerNumber, String ServerName) in C:Visual Studio 2013ProjectsPrintAndApplyDataObjectsOracleDataProvider.vb:line 984

1:    at USG.LinX.PrintAndApply.Utilities.EventLogger.LogEvent() in C:Visual Studio 2013ProjectsPrintAndApplyUtilitiesEventLogger.vb:line 62

1:    at USG.LinX.PrintAndApply.Utilities.AppEvents.Log(String msg, EventType EventType, String OrgCode, Int32 LineNumber, Char Leg, Int32 StackerNumber) in C:UsersPKonstantDocumentsVisual Studio 2013ProjectsPrintAndApplyUtilitiesAppEvents.vb:line 38

1:    at USG.LinX.PrintAndApply.BusinessObjects.BLineReader.Run() in C:Visual Studio 2013ProjectsPrintAndApplyBusinessObjectsServiceBLineReader.vb:line 821

1:    at USG.LinX.PrintAndApply.BusinessObjects.BLineReader.StartProcessingCore() in C:Visual Studio 2013ProjectsPrintAndApplyBusinessObjectsServiceBLineReader.vb:line 139

Exception Level 1: Target Site:Void .ctor(System.Data.OracleClient.OciHandle, HTYPE, MODE, HANDLEFLAG)

Event Viewer has the following:

Faulting application printandapply.exe, version 1.0.0.0, stamp 53c81478, faulting module oraociei12.dll, version 12.1.0.0, stamp 51cfc80d, debug? 0, fault address 0x00bd768c.

I am using Visual Studio 2013 with the Oracle Developer Tools for Visual Studio (12.1.0.1.2) libraries.  Any help would be surely appreciated.

Many Thanks

Peter

Problem

New installation of Controller

Unable to connect to Controller when using Cognos 8 or Windows Authentication, see error below.

Symptom

System.Web.Services.Protocols.SoapException: Server was unable to process request. —> System.Exception: OCIEnvCreate failed with return code -1 but error message text was not available. at
Cognos.Controller.Proxy.ControllerReportNetService.RepNet.GetUserInfo (String sGuid, String sUser, String passportId) at
Cognos .Controller.Proxy/CCRWS.GetUserInfo(String sGuid, String sUser, String passportId

Cause

Incorrect Oracle client ‘configuration’ on the Controller application server

Environment

Controller Oracle database

Resolving The Problem

Ensure that only one oracle client 32bit is installed AND configured on the Controller application server

— Un-install any older and unnecessary Oracle Client
— PATH environment variable should have only one oracle client path
— oci.dll, there should be only one (unable to delete it at this time)
— Reboot the Controller application server
— Delete the folder structure for the un-installed oracle client (which contains the oci.dll)

In this particular scenario, the older oracle client was installed and the PATH was updated (older path removed). The client wasn’t able to delete the directories and/or oci.dll from the older oracle client installation until the server was rebooted.

[{«Product»:{«code»:»SS9S6B»,»label»:»IBM Cognos Controller»},»Business Unit»:{«code»:»BU059″,»label»:»IBM Software w/o TPS»},»Component»:»Controller»,»Platform»:[{«code»:»PF033″,»label»:»Windows»}],»Version»:»10.1.1″,»Edition»:»»,»Line of Business»:{«code»:»LOB10″,»label»:»Data and AI»}}]

  • Remove From My Forums
  • Вопрос

  • Hi, All:

    I am using the tool SQL Server Migration Assistant for Oracle to move an existing Oracle onto sql server. However, I can’t connect to a source Oracle database from this tool, even though I can use PLSQL developer to do Oracle connection. I have googled Internet
    and follow suggestions to make security permission changes on Oracle client home page. Unfortunately, it is failed with the following error:

    Connection to Oracle failed.
    OCIEnvCreate failed with return code -1 but error message text was not available.

    Please help me use SQL server instead of Oracle.

    Oracle client home is: C:apporacleproduct11.2.0client_1

    Regards,

Ответы

  • Hi, David:

    I finally make the progress that I find the problem and solve it. Thanks a lot for your effort!

    • Предложено в качестве ответа

      25 сентября 2013 г. 9:38

    • Помечено в качестве ответа
      msdn_msg
      25 сентября 2013 г. 15:36

  • Hi,

    I’m glad to hear that you found a good idea to resolve your question.If you find out the root cause finally and share your solutions & experience here, it will be very beneficial for other community members who have similar questions.

    Thanks

    Candy Zhou

    • Изменено
      Candy_Zhou
      25 сентября 2013 г. 9:44
      edit
    • Помечено в качестве ответа
      msdn_msg
      25 сентября 2013 г. 15:36

Days ago, I experienced technical issue while I set up the oracle ODBC connection for one of our third-party application which is required to get oracle database connection. This application is windows-based ASP.NET application sitting on Windows Server 2003.

To prepare the database connection, I installed Oracle Client software and created new TNS name pointing to target database with no problem. After setting the database connection within application, I was surprised getting the following error message while I tested via internet explorer.

System.Exception: OCIEnvCreate failed with return code -1 but error message text was not available.

I know it is because of no permissions to access oracle client while the connection was trying to create environment.  My quick search shows that there is one possible way to solve it by changing configuration file of Microsoft .Net Framework. But, that’s not my preferred way because any direct changing on very low level of system file could raise unexpected problem. Another method is to adjust permissions manually and it works to my situation.

Step 1: Log on Windows as a user with Administrator privileges

Step 2: Launch Windows Explorer from and navigate to the ORACLE_HOME folder. In my case, it’s installation path of Oracle Client Software.

Step 3: Right-click on the ORACLE_HOME folder and choose the “Properties” option

Step 4: Click on the “Security” tab of the “Properties” window

Step 5: Click on “Authenticated Users” item in the “Name” list

Step 6: Uncheck the “Read and Execute” box in the “Permissions for Administrators” list under the “Allow” column and then re-check the “Read and Execute” box under the “Allow” column (this is the box you just unchecked).

After doing that, the section “Permissions for Administrators” looks like below. In my case, above actions un-checked “Full Control” and “Modify” under the Allow” column.

Step 7: Click the “Advanced” button and in the “Permission Entries” list make
sure you see the “Authenticated Users” listed there with:
Permission = Read & Execute
Apply To = This folder, subfolders and files
If this is NOT the case, edit that line and make sure the “Apply onto”
drop-down box is set to “This folder, subfolders and files”.  This
should already be set properly but it is important that you verify this.

Step 8: Click “OK” button to apply the changes you made and then reboot your windows server.

Done!!!

Print Friendly, PDF & Email

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.

  1. 1
    OCIEnvCreate failed with return code -1

    1. 1.1
      Cause

    2. 1.2
      Solution

      1. 1.2.1
        Download Oracle Client for Windows (x64)

      2. 1.2.2
        Install Oracle Data Provider

      3. 1.2.3
        Get the installed Oracle Client Path


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
    • Instant Oracle Client Downloads for Microsoft Windows (x64)
    • Oracle Data Provider for .NET (x64)
  • 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
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:appXXXproduct11.2.0client_2odp.netbin2.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
  • 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.

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Oci error php
  • Oci 22053 overflow error
  • Ochiru hitozuma syntax error
  • Ocf ошибка частотника schneider
  • Ocenaudio как изменить голос

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии