3 Replies Latest reply: Mar 22, 2012 1:38 AM by Sudheendra-Oracle RSS

    ORA-24960 error

      I am am beginner to db programming and I am using OCCI to connect to a oracle db . I have Oracle 11g admin installation on Windows 64 and I am using Visual studio 2005 on Win 7 64 bit.

      I am trying to make a simple connection using the OCCI but I get the following error

      const std::string lUserName = _T("abcdef");
      const std::string lPassword = _T("abc12345");
      const std::string lServerName = _T("");
      lpConnect = lpEnv->createConnection(lUserName, lPassword);

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

      It looks like the character string is getting corrupted and I dont know if this ia a problem with visual studio compile options or something else. Also, I did read that we need to use the server name in the tnsname.ora . I havent used any. Is that the reason for the problem?
        • 1. Re: ORA-24960 error
          Probably, you need to declare Environment variable before you do the connection, and give it the lServerName as well.

          See if you could connect on your oracle with:
          sqlplus user/password
          sqlplus lUserName/lPassword@lServerName
          lpEnv = Environment::createEnvironment(EnvMode);
          m_lpConnect = lpEnv->createConnection(lUserName, lPassword, lServerName);
          catch(SQLException& e)
          std::cout << "DataBase::Connect - SQLException - failed with: " << e.getMessage().c_str() <<" , error code " <<"(" << e.getErrorCode() << ")\n";
          catch (std::exception& e)
          std::cout << "DataBase::Connect - exception - failed with: " << e.what() << std::endl;
          catch (...)
          std::cout << "DataBase::Connect - unknown exception" << std::endl;

          actually, it should work your code.
          • 2. Re: ORA-24960 error
            try it:

            Environment::createEnvironment("UTF8","UTF8", Environment::DEFAULT);

            see if it works!?!
            • 3. Re: ORA-24960 error
              You need to verify which version of VS was used to build oraccci11.dll and ensure you use the same version to build your application.
              I have seen similar error message if you end up using a version different of VS than what was used to build oraccci11.dll to build your application.
              BTW look at the below site to download occi dlls built using different version of Visual Studio.