2 Replies Latest reply: Jun 13, 2008 1:43 PM by 506895 RSS

    cannot create environment in another computer

    602644
      Hello,

      I just got a weird problem when I try to access oracle database by OCCI in my program:

      Everything runs well in my computer;
      Environment::createEnvironment returns NULL in another computer;

      Attached is my test code, which runs well in my computer. when I try to debug remotely in another computer, i found that Environment::createEnvironment(); returns NULL and throws an exception. but there is no message in the SQLException.

      I really appreciate your help.
      Damon

      #include <occi.h>
      #include <string>
      #include <iostream>
      using namespace oracle::occi;
      using namespace std;

      void main(int argc, char * argv[])
      {
           Environment     pEnvironment;          Connection     pConnnection;
           Statement     *pStatement  ;

           string retStr;
           try
           {
                pEnvironment= Environment::createEnvironment();     
                pConnnection= pEnvironment->createConnection("portfolio", "manager", "db001");

                pStatement = pConnnection->createStatement();
                cout<<"success"<<endl;

           }catch (SQLException &ex)
           {
                retStr = "ERROR in create connection: ";
                retStr +=ex.getMessage().data();
                cout<<retStr<<endl;
                exit(-1);
           }
           if( pConnnection!=NULL)
           {
                pConnnection->terminateStatement(pStatement);     
                pEnvironment->terminateConnection(pConnnection);
           }
           if( pEnvironment!=NULL )
                Environment::terminateEnvironment(pEnvironment);
      }