Hi,
I get this error when my .Net Windows application exe 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.And am using "x86" as target platform in my VS.Net 2010 settings.Am able to connect to db on this machine using a Console application but not from an exe.
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?
Gohil JayendrasinhPosted Mar 13, 2012, 2:29 AM
Follow these steps on your Windows 7 64-bit PC to connect to your ODBC data source.
1. Through Oracle's web site, go to Instant Client Downloads for Microsoft Windows (x64). Currently, the address to that page is:
http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winx64soft.html
2. Download the two following files, found under the version 11.1.0.7.0 heading:
Instant Client Package - Basic (instantclient-basic-win-x86-64-11.1.0.7.0.zip)
Instant Client Package - ODBC (instantclient-odbc-win-x86-64-11.1.0.7.0.zip)
3. Extract both zip files to the same directory (such as c:\oracle\instantclient_11_1).
4. Launch the Command Prompt (DOS command window) by running it as administrator. Go to Start > All Programs > Accessories, then right click Command Prompt and select Run as Administrator.
5. From within the Command Prompt, navigate to c:\oracle\instantclient_11_1, and run odbc_install.exe. You should receive a message saying Oracle ODBC Driver is installed successfully. The name of the new ODBC driver that was just installed is Oracle in instantclient11_1 -- use this driver when creating your ODBC connection.
6. Create a new system environment variable. Set the value of the variable name as TNS_ADMIN, and the value of the variable path as the directory that contains the tnsnames.ora and sqlnet.ora files. On my PC, I have another Oracle client already installed which has its own tnsnames.ora and sqlnet.ora files. Therefore, I set the value of variable path as c:\orant\net80\admin (the directory that contains my tnsnames.ora and sqlnet.ora files). If you don't have another Oracle client installed on your PC, create a new directory such as c:\oracle\instantclient_11_1\network\admin, and place the tnsnames.ora and sqlnet.ora files in that directory. Then, set c:\oracle\instantclient_11_1\network\admin as the value for the variable path.
7. To create the ODBC connection, go Start > Control Panel > Administrative Tools > Data Sources (ODBC). Alternatively, you can create the connection right from within Excel.
[/quote]
if working then please
check Accepted Asnwers