ociEnvCreate failed with return code

Hi

I am new to VB.net windows application

i am using VS2005

and oracle client for database connection

i am getting this error when i run the application

"ociEnvCreate failed with return code - 1 but error message text was not availabe"

can anyone help me plz

Thanks in advance




Answer this question

ociEnvCreate failed with return code

  • Mix from Latvia

    If you want the error log to live on the server then yes you need to set the path to the errorlog: ( and make sure you have read write permissions to that directory)

    \\MyServerName\AccessibleDirectory\ErrorLog.txt

    The application.info.directorypath will return the local path of the executable



  • Daigu

    after step two...use the dropdown box at the top left to select "application events" and then from the top right select "Unhandled exception"...you should get this:



    Namespace
    My

    ' The following events are availble for MyApplication:

    '

    ' Startup: Raised when the application starts, before the startup form is created.

    ' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.

    ' UnhandledException: Raised if the application encounters an unhandled exception.

    ' StartupNextInstance: Raised when launching a single-instance application and the application is already active.

    ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.

    Partial Friend Class MyApplication

    Private Sub MyApplication_UnhandledException(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException

    Dim ErrorLog As String = Application.Info.DirectoryPath & "\ErrorLog.text"

    Dim sw As System.IO.StreamWriter = My.Computer.FileSystem.OpenTextFileWriter(ErrorLog, True)
    sw.WriteLine(Now.ToString)
    sw.WriteLine(e.Exception.Source)
    sw.WriteLine(e.Exception.Message)
    sw.WriteLine(e.Exception.StackTrace)
    sw.Close()
    sw.Dispose()
    End Sub

    End Class
    End
    Namespace



  • G. Dean Blakely

    Hi

    my deployment machine has oracle client

    i have to write try/catch in all the method(connecting database) in my application to write the calling procedure name in error log

    i am new to dot net.

    can give me sample code to do this

    Thanks



  • xavito

    The information in this thread so far is COMPLETELY useless and unhelpful. The application log does nothing but record the exact same error. I've never seen such a vague and worthless error message.

    I'm getting the same error after installing ODP .NET. How could ODP .NET break the Microsoft Provider

    TNSNAMES.ora is still in-tact. Re-installing the microsoft provider doesn't help. My only option left is to re-image the machine.


  • raq

    hi

    actually it works in my machine.(when i debug)

    when i deployed it in my client machine using Clickonce , i am getting this error

    i even tried copying the exe to client machine still getting the same error

    i dont know in which line i getting this error as i am running from exe



  • Newbeski

    No you do not have to go back and error trap all of your code....the quick way to find out where this is comming from is to double click on myproject and then from the Application tab click on view application events...and then use the unhandled exception event to write your trace....NOTE...This will only work from the release/executable it will not work from debug...debug will catch and display the exception...however during runtime the app will crash and a log will be written

    Private Sub MyApplication_UnhandledException(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException

    Dim ErrorLog As String = Application.Info.DirectoryPath & "\ErrorLog.text"

    Dim sw As System.IO.StreamWriter = My.Computer.FileSystem.OpenTextFileWriter(ErrorLog, True)

    sw.WriteLine(Now.ToString)

    sw.WriteLine(e.Exception.Source)

    sw.WriteLine(e.Exception.Message)

    sw.WriteLine(e.Exception.StackTrace)

    sw.Close()

    sw.Dispose()

    End Sub



  • amendez

    What line of code is throwing the error



  • ideal24293

    Does the deployment machine have the oracle drivers installed

    Also you can go back to the source and write in some error handleing code that will atleast log the error to a textfile with the name of the calling procedure...this will help greatly when trying to figure out runtime problems!



  • Pieter Nelson

    I am running into this error and I have done everything. I ran filemon and saw that w3wp.exe was getting access denied. It was running under network authority\network service. I changed the permissions to give that user access to give thatr user access to the oracle\ora92 directory and everything underneath and I am still getting that error. Anybody have any idea what is going on

  • AhV Sharky

    Hi

    Thanks for your reply.

    your code works perfectly.

    coming back to my problem

    i re-installed the oracle client in my deployment machine.

    now i am not getting this error

    "ociEnvCreate failed with return code - 1 but error message text was not availabe"

    sorry for wasting all your time.Any way i learned a new thing(application event) in this conversation.

    i have another question.Please reply if you have time.

    After  deploying  my application through clickonce,

    when the user access the application from startup menu , this error log file is not created in server, instead  it is creating in localmachine of the user(c:\document and settings\user\........errorlog.text)

    Actually i want this to be created in server

    is there anything that i have to change in application path(Application.Info.DirectoryPath & "\ErrorLog.text)

    Thanks

     



  • Seiggy

    Hi

    thanks. it works after giving the network path.



  • ykgreene

    Did your application work after giving the network path or did the error logging work

    I'm having the same issue. My .net application hosted on one of our IT's servers was working, then last Monday I got an error message saying that Oracle version 8.1.7 or higher was required. Our IT group installed Oracle Client 10.2.0.1, reset permissions, and modified the registry, and now we get the OCIEnvCreate failed with return code -1 but error message text was not available message.

    What did you actually change to get your application working Thanks.



  • thussain

    Hi

    Thanks for your reply

    This is the first time i am writting application events in VB.net

    can you please help me in this

    i did following steps to write application events that you have send

    With a project selected in Solution Explorer, click Properties on the Project menu.

    1. Click the Application tab.

    2. Click the View Application Events button to open the Code Editor.

    after opening applicationevents.vb i dont find MyApplication Events in general menu.

    when i copied and past your code i getting "statement is not valid in namespace" error

    is there anything i am missing

    Thanks



  • ociEnvCreate failed with return code