12 Replies Latest reply: Aug 25, 2011 2:34 AM by kmohan RSS

    Fail when invoking Environment::createEnvironment(..) in Visual Studio 2005

    499267
      I'm trying to create a connection to an Oracle 10.2g database by means of the occi library, but the command Environment::createEnvironment(Environment::DEFAULT) fails to succeed: The returned error is ora 32104 - "cannot retrieve OCI error message". My IDE is Visual Studio 2005, and the libraries deployed are located in the Oracle 10.2 client software.

      Can someone help me? It may be some linking problems, but I'm not able to figure this out.

      Thanks,
      Espen
        • 1. Re: Fail when invoking Environment::createEnvironment(..) in Visual Studio
          Shiyer-Oracle
          Did you download the VS2005 (VC8) compiled OCCI DLLs for 10.2.0.1.0 from :-

          http://www.oracle.com/technology/tech/oci/occi/occidownloads.html

          Thanks.
          • 2. Re: Fail when invoking Environment::createEnvironment(..) in Visual Studio 2005
            499267
            Hi shiyer,

            Thanks for your tip. I've downloaded and installed the VS2005 (VC8) compiled OCCI DLLs for 10.2.0.1.0, but I still have a linking problem: The version of oci.lib (part of the Oracle 10.2.0.1.0 client I've installed) have a referance to the DLLs for VC71, so it does not link to the VC8 version. Can this be solved by a download? Or otherwise?

            Thanks.
            Espen
            • 3. Re: Fail when invoking Environment::createEnvironment(..) in Visual Studio
              Shiyer-Oracle
              Other Oracle client libraries e.g OCI.dll, ORACLIENT10.dll having references to MSVC 7.1 runtime libraries is okay and you should not see any problem due to this. I think the MSVC 7.1 runtime libraries - msvcr71.dll should be available in the Oracle client installation or you need to get them from Microsoft.

              Regards.
              • 4. Re: Fail when invoking Environment::createEnvironment(..) in Visual Studio
                499267
                Hi again,

                Now my code can invoke the createEnvironment command, but unfortunately it triggers another error when invoking createConnection(..). I receive ora-29460 "The attribute is greater than the maximum allowable lenght of 255". This is not the case, however.

                Can you help me resolve this?

                Thanks again,
                Espen
                • 5. Re: Fail when invoking Environment::createEnvironment(..) in Visual Studio
                  535947
                  Hi!!
                  I saw your post....and I have the same problem...How you resolve it ?


                  MY PROBLEM:


                  I have a problem with creating a connection to a Oracle 10g Database. I installed Oracle Client 10g.
                  I have a C++ program an work with the Microsoft Visual C++ .NET 2005.
                  My problem refers to the following code:


                  Environment *env;
                  Connection *con;
                  Statement *stmt;


                  env = Environment::createEnvironment(Environment::DEFAULT);
                  con = env->createConnection(user, passwd, db);



                  ERROR DESCRIPTION:

                  Error number: 24960


                  ORA-24960: the attribute OCI_ATTR_USERNAME is greater than the maximum allowable length of 255


                  OCIAttrGet with OCI_ATTR_USERNAME = -2


                  New Oracle C++ Call Interface (OCCI) libraries are available for Microsoft Visual C++ .NET 2005 ??


                  I set user = "" ... so is not too long!!!!

                  Thanks!!
                  • 6. Re: Fail when invoking Environment::createEnvironment(..) in Visual Studio
                    499267
                    Hi,

                    I started a new thread when I was experiencing other problem. I do not know to make a link to a thread, so I've copied and pasted my final text on this matter.

                    "Oracle could save themself a lot of support issues if they provided a procedure for how to set up the newest Visual Studio release with the newest Oracle release. My problem has been:
                    - Difficult to set up the correct order of loading files/libraries before linking in Visual Studio - due to my novice skills with Windows programming.
                    - Some debug DLLs where required for OCI lib that where part of the VS 2003 installation, and not included in the Oracle client installation (msvcr71d.dll and msvcp71d.dll)."

                    Good luck
                    • 8. Re: Fail when invoking Environment::createEnvironment(..) in Visual Studio
                      458985
                      Hi,

                      I encountered the error message "the attribute OCI_ATTR_USERNAME is greater than the maximum allowable length of 255" although the string was only 3 characters.

                      The reason was I used STLport strings, but OCCI does not support STLport strings (which I did not know by then, or had forgotten); the password and user name and db connection string were obviously corrupted because of this incompatibility. I got no linker errors or warnings, neither any compiler errors or warnings, just the above-mentioned error message. I also got an error message informing me that the service specified by the database connection string could not be found so I spent half a day figuring about whether I had configured my Oracle client incorrectly.

                      Then, when I stopped using STLport strings, and instead used the STL shipped with MSVS 7.1, everything worked.

                      Regards, Magnus
                      • 9. Re: Fail when invoking Environment::createEnvironment(..) in Visual Studio
                        549692
                        I encountered the same question , ORA-24960, NOW I have solve it.
                        first , download the occivc8windows.rar from oracle , the floor two have the address
                        now paste the readme.txt in this rar file.
                        OCCI libraries for Microsoft Visual C++ 8
                        *****************************************
                        The archive occivc8windows.zip contains :-

                        1) oraocci10.lib
                        2) oraocci10.dll
                        3) oraocci10d.lib
                        4) oraocci10d.dll
                        5) occivc8_readme.txt (this README)

                        These updated librares are required to build OCCI applications
                        using the Microsoft Visual C++ 8 compiler (Visual Studio 2005).
                        These libraries are for the Oracle 10.2.0.1.0 release for
                        Microsoft Windows(32-bit).

                        oraocci10d.lib/oraocci10d.dll should be used if the application is
                        to be linked with the debug version of Microsoft CRT (msvcrtd.dll and
                        msvcprtd.dll).


                        Installation Instructions
                        -------------------------
                        1) Create a new sub-directory "vc8" under %ORACLE_HOME%\oci\lib\msvc

                        2) Copy the .lib and .dll files from this archive to
                        %ORACLE_HOME%\oci\lib\msvc\vc8

                        3) Include %ORACLE_HOME%\oci\lib\msvc\vc8 directory in the list of library
                        directories when linking the application. Include oraocci10.lib or
                        oraocci10d.lib, as appropriate, in the application link command.

                        4) Ensure that %ORACLE_HOME%\oci\lib\msvc\vc8 is first in the PATH when
                        running the application.

                        Instant Client Installation
                        ---------------------------
                        The OCCI DLL oraocci10.dll present in this
                        package can replace the default oraocci10.dll in the
                        Oracle 10g R2 Instant Client Basic package for deploying
                        OCCI applications.

                        carefully , if you are in debug model , use the oraocci10d.lib, not the oraocci10.lib.

                        second, if you use the oracle 10g2 ,
                        copy the libs and dlls file to the path %oracle_home%\db_1\BIN , it is be in BIN directory.
                        I find out the vs2005 will search this directory to load the oraocci10.dll or oraocci10d.dll
                        • 10. Re: Fail when invoking Environment::createEnvironment(..) in Visual Studio 2005
                          495663
                          I had 32104 error when working with visual studio 2010 running on Windows 7 enterprise x64 EN (OCCI basic lite). This is how I have solved the problem:

                          In visual studio:
                          1. Configuration Properties -> C\C++ -> General -> Additional Include Directories : add path to header files in OCCI sdk
                          2. Configuration Properties -> Linker -> Additional Dependencies : add oraocci11.lib, oci.lib (probably oci.lib is not necessary)
                          3. Copy oraocci.dll, oci.dll and oraociicus11.dll (most important library in my situation) to folder where your executable is.

                          There is no need to set PATH evironment variable because windows is looking for libraries in the same folder the executable is first.
                          • 11. Re: Fail when invoking Environment::createEnvironment(..) in Visual Studio
                            178127
                            Anyone happens to have a copy of occivc8windows.zip available for download?
                            Thanks