OCIEnvCreate Failed Error - When accessing .aspx pages

11,973

Solution 1

I've come across the same problem with oracle 10g, from what I've read this error seems to mean that the .Net oracle driver can't find the oracle client.

There are various suggestions to fix this, including checking the PATH and ORACLE_HOME environment variables; re-installing the oracle client in the default location (C:\oracle) if it isn't already there; or using oracle's Oracle Data Provider for .NET (ODP.NET) instead of the Microsoft oracle driver (System.Data.OracleClient).

None of the above fixed my problem however, so if anyone has any more suggestions they would be most welcome!

Solution 2

We've recently run into this as well; in our case, restoring the ORACLE_HOME environment variable did the trick (an incomplete installation of OMS10G that had left the system in an inconsistent state with the environment variable registering as null).

Share:
11,973
flowy
Author by

flowy

Updated on June 25, 2022

Comments

  • flowy
    flowy almost 2 years

    I am currently stuck on an ASP.NET error when trying to access a .aspx page through localhost. This is the error:

    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.

    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) +363
       System.Data.OracleClient.OciEnvironmentHandle..ctor(MODE environmentMode, Boolean unicode) +23
       System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName) +122
       System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString connectionOptions) +135
       System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +36
       System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28
       System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424
       System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +68
       System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +519
       System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82
       System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +104
       System.Data.OracleClient.OracleConnection.Open() +37
       Wilson.ORMapper.Internals.Connection..ctor(String connectString, CustomProvider customProvider) +287
    
    [ORMapperException: ObjectSpace: Connection String is Invalid - OCIEnvCreate failed with return code -1 but error message text was not available.]
       Wilson.ORMapper.Internals.Connection..ctor(String connectString, CustomProvider customProvider) +357
       Wilson.ORMapper.Internals.Context.Init(XmlDocument xmlMappings, String connectString, CustomProvider customProvider, Int32 sessionMinutes, Int32 cleanupMinutes) +92
       Wilson.ORMapper.Internals.Context..ctor(Stream mappingStream, String connectString, CustomProvider customProvider, Int32 sessionMinutes, Int32 cleanupMinutes) +171
       Wilson.ORMapper.ObjectSpace..ctor(Stream mappingStream, String connectString, Provider providerType, Int32 sessionMinutes, Int32 cleanupMinutes) +66
       zedi.DataManager.GetDefaultInstance() in C:\projects\FINE Application Interface\Production\On-site Backlog\Source\Code\DataAccess\ORClasses\Data\DataManager.cs:155
       zedi.DataManager.get_ObjectSpaceGlobal() in C:\projects\FINE Application Interface\Production\On-site Backlog\Source\Code\DataAccess\ORClasses\Data\DataManager.cs:105
       zedi.DataManager.get_ObjectSpace() in C:\projects\FINE Application Interface\Production\On-site Backlog\Source\Code\DataAccess\ORClasses\Data\DataManager.cs:129
       zedi.DataObjects.CompanyBase.RetrieveQuery(ObjectQuery query) in C:\projects\FINE Application Interface\Production\On-site Backlog\Source\Code\DataAccess\ORClasses\DataObjects\Base\CompanyBase.cs:279
       zedi.DataObjects.CompanyBase.RetrieveAll(String sortClause) in C:\projects\FINE Application Interface\Production\On-site Backlog\Source\Code\DataAccess\ORClasses\DataObjects\Base\CompanyBase.cs:78
       maint_inetpub.siteTemplates.updateDeviceTemplate.Page_Load(Object sender, EventArgs e) in c:\projects\FINE Application Interface\Production\On-site Backlog\Source\Code\Websites\maint-inetpub\siteTemplates\updateDeviceTemplate.aspx.cs:47
       System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
       System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
       System.Web.UI.Control.OnLoad(EventArgs e) +99
       System.Web.UI.Control.LoadRecursive() +47
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436
    

    I notice it says the I have an invalid connection string but I have tested it and it works. I currently have Oracle 10g Express installed and before that I had Oracle 8i Client. It was working before I installed 10g Express.

  • Fabio
    Fabio about 12 years
    That's worked for me. I've been working with an ASP.NET app connection to a Oracle database using just Oracle instantclient 10.2. Then I installed Oracle 11g Express, and this error started to show. I just remove "C:\oraclexe\app\oracle\product\11.2.0\server\bin;;" from PATH env. variable, and everything got normal again. Thanks.
  • AnisNoorAli
    AnisNoorAli about 8 years
    Solution after 2008 :D