0 Replies Latest reply: Apr 1, 2013 10:12 AM by 1000255 RSS

    OCCI : Unhandled exception with getString() ,msvcp100d.dll Access violation

    1000255
      Hi All,

      Program compilation and linking is successful but While running the program got error "Unhandled exception at ox774aad4a ( msvcp100d.dll) in sample.exe : 0xC000005: Access violation reading location 0xcccccd0."

      curser reached to line ( _Pnext != 0; Pnext = (*Pnext)->_Mynextiter) given below of xutility.

      inline void Containerbase12::_Orphan_all()
           {     // orphan all iterators
      #if ITERATORDEBUG_LEVEL == 2
           if (_Myproxy != 0)
                {     // proxy allocated, drain it
                Lockit Lock(_LOCK_DEBUG);

                for (_Iterator_base12 **Pnext = &Myproxy->_Myfirstiter;
                     _Pnext != 0; Pnext = (*Pnext)->_Mynextiter)
                     (*Pnext)->Myproxy = 0;
                Myproxy->Myfirstiter = 0;
                }
      #endif /* ITERATORDEBUG_LEVEL == 2 */
           }


      if i remove line string r1 = rs->getString(1); ( from below code ) then program runs successful.

      Program raise exception wiht with getString()

      Visual studio : 2010 ultimate
      OS : windows 7 ( 64 bit )
      Oracle : 11.2.0.1.0

      Oracle instant client : instantclient-basic-win32-11.2.0.1.0
      OCCI : occivc10_11202_win32

      properties->c/c++->General-> Additional Include Directories = C:\app\expert\product\11.2.0\dbhome_1\OCI\include

      Where oracle home is C:\app\expert\product\11.2.0\dbhome_1

      properties -> Linker -> additional Dependencies = C:\Ravib\occivc10_11202_win32\*.lib

      path is instant client is C:\Ravib\instantclient-basic-win32-11.2.0.1.0\instantclient_11_2 and added first string in path variable.


      code is

      #include<occi.h>
      #include<iostream>
      #include<string>

      using namespace std;
      using namespace oracle::occi;
      using namespace OCCI_STD_NAMESPACE;



      int main()
      {
           try
           {
                const string userName = "infodba"; // User
                const string password = "infodba";     // Password     
                const string connectString = "localhost:1521/TC91_ITKDEV"; // host:[port][service name] by loolking tnsname.ora

                

                Environment *env = NULL;
                Connection *conn = NULL;
           
                env = Environment::createEnvironment(oracle::occi::Environment::DEFAULT);
           
                conn = env->createConnection(userName, password, connectString);

                Statement *stmt = conn->createStatement("SELECT PITEM_ID, RUOM_TAGC, PIS_VI FROM PITEM"); // PITEM_ID is varchar2 (15 ) and RUOM_TAGC, PIS_VI  are number

                ResultSet *rs = stmt->executeQuery();

                
                while(rs->next()) {

                
                     string r1 = rs->getString(1);
                     cout<<r1<<endl;
                     int result1 = rs->getInt(2);
                     int result2 = rs->getInt(3);
                     cout<<result1 <<" "<< result2<<endl;

                }


                stmt->closeResultSet(rs);
                conn->terminateStatement(stmt);
                env->terminateConnection(conn);
           }
           
           catch ( exception &x)
           {
                cout << "Eception thrown"<<endl;
                cout << x.what () << endl;
           }
           
      return 0;

      }