As noted by the question’s title, I’m trying to connect to an Oracle database from a Windows service and I am getting the following error message:
System.Exception: OCIEnvNlsCreate failed with return code -1 but error message text was not available.
Other applications on the same computer are connecting to Oracle without any issues and I have tried running the service both as the Local System and using my own user credentials. Any ideas how to resolve this situation?
This error occurs with several related problems, any one of which may be yours.
You need to make sure the Enviornment variables oracle needs are set properly in your windows settings. Examples include
TWO_TASK,TNS_ADMIN, andNLS_LANG.If you have multiple Oracle installations, your program may not be finding the correct ORACLE_HOME and the corresponding correct libraries (DLLs). Make sure you have the
PATHandORACLE_HOMEset correctly as well.