gccrhelrhel8occi

Error "ORA-01017: invalid username/password; logon denied" when trying to connect to Oracle Database using OCCI and GCC


This is an issue we have connecting to Oracle Database using GCC. Currently both the client and the server are running under the same environment, which is running RHEL 8. We are in the process of migrating the OS from CentOS 7 to RHEL 8, and the identical application code successfully connects to and queries the database when run under CentOS 7.

Here is the application code:

#include <occi.h>

if (!oracleEnvironment) oracleEnvironment = oracle::occi::Environment::createEnvironment();
oracle::occi::Connection *databaseConnection = oracleEnvironment-createConnection("our_username", "our_password");

We know that the username and password we are using are correct (though they've been altered in the code sample I posted here), since we have validated this by running sqlplus on the same machine and connecting with that username and password.

So when we run this under CentOS 7 and gcc 10.2.1, it works fine. But the same thing under RHEL 8 and gcc 10.3.1, it does not, and we get that Oracle error. Sometimes we've also gotten the error "ORA-24960: the attribute OCI_ATTR_USERNAME is greater than the maximum allowable length of 255" instead of the invalid username/password error. But again, this works fine under CentOS 7 but not RHEL 8.

I suspect that the ORA-01017 error and the ORA-24960 error are related or maybe have the same underlying cause, since I found the following questions which all have answers suggesting the same solution, which is to change the value of the GCC flag _GLIBCXX_USE_CXX11_ABI:

However, I tried changing that flag and rebuilding my application and I still encountered the same problem.

The answers in the first two of these questions seem to suggest that the current versions of GCC (possibly since GCC 7) are not compatible with current version's of Oracle's OCCI. But GCC 7 has already been available for more than 6 years. So is this really the case?


Solution

  • @ChristopherJones suggested in a comment to the question, that I look at Oracle's documentation to find out what version of GCC Oracle says is compatible with my version of the Oracle software. I did eventually find this from Oracle, which states:

    Note: For OCCI applications on Linux-x86-64 using g++5.3, g++6.3, g++7.3 and g++8, instead of the libocci.so.21.1 library, link to the $ORACLE_HOME/lib/libocci_gcc53.so.21.1 library.

    So, linking to this alternate library seems to have solved it