This discussion is archived
3 Replies Latest reply: Mar 21, 2012 11:38 PM by 423410 RSS

ORA-24960 error

924496 Newbie
Currently Being Moderated
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
    923765 Newbie
    Currently Being Moderated
    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
    or
    sqlplus lUserName/lPassword@lServerName
    try
    {
    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
    923765 Newbie
    Currently Being Moderated
    try it:

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

    see if it works!?!
  • 3. Re: ORA-24960 error
    423410 Explorer
    Currently Being Moderated
    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.
    http://www.oracle.com/technetwork/database/occidownloads-083553.html

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points