Reputation: 739
I get this error when my .Net winforms application tries to connect to Oracle database on a 64-bit Windows 7 machine.Am using System.Data.OracleClient.dll as a provider.
OCIEnvCreate failed with return code -1 but error message text was not available.
Am able to connect to the same database using a "udl file" and using "SQL Plus" utility on this machine.
On my windows 7 machine, ORACLE_HOME directory is correctly pointing to 32 bit client in the environment variable and registry too, but still am getting the same error.
Also, am able to connect to this database from .Net app on a Windows XP machine even if does not have any of these environment variables present.
Could you please advise?
Thanks for reading.
Upvotes: 1
Views: 2488
Reputation: 572
From your question, it may be useful to know your setup i.e. VS2010 /2008 etc.?
Is this a recent problem or a new machine build?
Do you have a single oracle client installation i.e. which version, or are you trying to use instant client? (did you have an old version previously installed that may be causing the confusion)
The System.Data.OracleClient is now depreciated and ODP.NET (Oracle.DataAccess) is a suggested replacement direct from oracle.
I have a windows 7 development machine with VS2010 + ODP.NET 11.2 (ODAC) with a 11.1 32bit client and a 64bit client (not sure if I needed this one).
Does your solution build or do you get this error message when using the gui or at runtime? Are you able to use the server explorer within VS to connect? Do you have a .net application that uses oracle that works and can be tested on your machine?
You could also set the TNS_ADMIN path in the environment.
Check that you have the path set including e.g. C:\Oracle\product\11.1.0\client32\bin, try to add it to the beginning of the path environment.
Does your application run under another account?
More than likely a client configuration issue like Antonio suggests.
Upvotes: 2
Reputation: 20693
Most common reason for that exception is that your ORACLE_HOME setting is incorrect or is pointing to 32-bit one, see:
Upvotes: 2