Forum Stats

  • 3,769,497 Users
  • 2,252,970 Discussions
  • 7,875,057 Comments

Discussions

OCIEnvInit fails

petehug
petehug Member Posts: 44
edited May 21, 2015 5:41PM in Oracle Call Interface (OCI)

I'm working on a 32 bit c++ app which I build using VS 2010 Express. I downloaded the 32 bit instant client 12.0.1.2. The basic client ended up here::

I:\oraclexe\XEClient\12.0.1.2\Win32

and the sdk here:

I:\oraclexe\XEClient\12.0.1.2\Win32\sdk

The search order for libs VS 2010 is set as follows:

I:\oraclexe\XEClient\12.0.1.2\Win32\sdk\lib\msvc\vc10

I:\oraclexe\XEClient\12.0.1.2\Win32\sdk\lib\msvc

I copied these files to the same folder as the executable I built:

I:\oraclexe\XEClient\12.0.1.2\Win32\oci.dll

I:\oraclexe\XEClient\12.0.1.2\Win32\ociw32.dll

I:\oraclexe\XEClient\12.0.1.2\Win32\VC10\oraocci12.dll


The reason I did all this is because I have 64bit Oracle11GR2 installed on the same machine, so env var ORACLE_HOME points to I:\oraclexe\app\oracle\product\11.2.0\server and I:\oraclexe\app\oracle\product\11.2.0\server\bin is in the PATH env var.  Obviously my 32bit app must link with 32bit libs and use 32bit DLLs hence the 32 bit client.

I verified OracleXE and the Listener are running and listening on port 1521.

Now whenever my app hits OCIEnvInit, it returns -1. I don't get any more info than that and can't explain why this happens nor where I should look for an answer:

OCIEnv* pEnv;

int status;

status = OCIEnvInit(&pEnv, OCI_DEFAULT, 0, 0);

Any help is greatly appreciated .

Best Answer

  • petehug
    petehug Member Posts: 44
    edited May 21, 2015 5:41PM Accepted Answer

    SOLVED:

    My problem was that I copied the wrong dll's into the same folder as my executables.

    I copied these files to the same folder as the executable I built:
    
    I:\oraclexe\XEClient\12.0.1.2\Win32\oci.dll
    I:\oraclexe\XEClient\12.0.1.2\Win32\ociw32.dll
    I:\oraclexe\XEClient\12.0.1.2\Win32\VC10\oraocci12.dll
    

    Once I copied these files all worked:

    I:\oraclexe\XEClient\12.0.1.2\Win32\oci.dll

    I:\oraclexe\XEClient\12.0.1.2\Win32\oraociei12.dll

Answers

  • petehug
    petehug Member Posts: 44
    edited May 21, 2015 5:41PM Accepted Answer

    SOLVED:

    My problem was that I copied the wrong dll's into the same folder as my executables.

    I copied these files to the same folder as the executable I built:
    
    I:\oraclexe\XEClient\12.0.1.2\Win32\oci.dll
    I:\oraclexe\XEClient\12.0.1.2\Win32\ociw32.dll
    I:\oraclexe\XEClient\12.0.1.2\Win32\VC10\oraocci12.dll
    

    Once I copied these files all worked:

    I:\oraclexe\XEClient\12.0.1.2\Win32\oci.dll

    I:\oraclexe\XEClient\12.0.1.2\Win32\oraociei12.dll

This discussion has been closed.