c++oracle11gocci

ora-1017 invalid username/password; logon denied using occi connection


I'm getting an ora-1017 error when trying to connect to my local oracle database(version 11.2.0.3) on an oracle linux version 5 virtual machine using occi.
Connection code piece:

  user = "MY_USERNAME";
  passwd = "MY_PASSWORD";
  db = "localhost:1521/my_instance_name";

  env = Environment::createEnvironment(Environment::DEFAULT);

  try
  {
    con = env->createConnection(user, passwd, db);
  }
  catch (SQLException& ex)
  {
    cout << ex.getMessage();

    exit(EXIT_FAILURE);
  } 

- I can connect to the schema using sqlplus.
- I tried setting SEC_CASE_SENSITIVE_LOGON to false, didn't help.
- The schema was created using uppercase username and password, I'm giving my variables uppercase values too, and as far as I know OCCI casts the credentials to uppercase anyway so it should work.
- ORACLE_SID environment variable is properly set, as well as the tnsnames.ora data too.
- By the way, this code was tested first on my host pc(win10) using visual studio 2010, and it was working properly, but not on my linux virtual machine(using virtualbox). I tried it using the host stated in tnsnames.ora and localhost both, still getting the same issue, but sqlplus lets me connect using both localhost and the tnsnames host.

I tried everything I could find on google, but still nothing, so if anyone has any useful tips it would be highly appreciated.


Solution

  • Turned out I needed to add the -D_GLIBCXX_USE_CXX11_ABI=0 flag to the compile command, it works now.