why OCCI is crashing when calling to createConnection without exception?

278 views Asked by At

I am trying to run the next code inside a big program.

  • In constructor init the Environment
  • In the relevant function, simple call to the Env variable to make sure it is valid and functioning.
  • call to the createConnection(). That's it. program vanish without even getting to the catch{} part.
  1. The values of m_sUsername,m_sPassword,m_sDbname are valid (work with simple demo program).
  2. Linking to -lclntsh -locci_gcc53 -lclntshcore -lnnz21
  3. gcc details: gcc (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5)
  4. Happens on both C++ 11 and c++ 17.
  5. Oracle Instant Client 21_5
  6. LD_LIBRARY_PATH=/home/OCCI/instantclient_21_5:/opt/product/oracle/19.0.0/client_1/lib:.:/usr/lib64:/usr/local/lib64
  7. The other program (simple demo) works fine.

What can cause such situation? Any idea is welcome.

OCCIDbs::OCCIDbs(){
 m_pOCCIenv = oracle::occi::Environment::createEnvironment(oracle::occi::Environment::DEFAULT);
}

SqlDbConnection* OCCIDbs::CreateConnectedConnection()
{
  if (!m_pOCCIenv) {
    LOGD("OCCIDbs::CreateConnectedConnection failed m_pOCCIenv is null");
    return nullptr;
  }
  LOGD("OCCIDbs::CreateConnectedConnection m_sUsername=%s, m_sPassword=%s, m_sDbname=%s",
    m_sUsername.c_str(), m_sPassword.c_str(), m_sDbname.c_str());

  oracle::occi::Connection* p = nullptr;
  try {  
    int majorVersion;
    int minorVersion;
    int updateNum;
    int patchNumber;
    int portUpdateNum;
    m_pOCCIenv->getClientVersion(majorVersion, minorVersion, updateNum, patchNumber, portUpdateNum);
    LOGD("OCCIDbs::CreateConnectedConnection() minorVersion =%d", minorVersion);
    
    LOGD("OCCIDbs::CreateConnectedConnection() m_sUsername=%s m_sPassword=%s m_sDbname=%s", m_sUsername.c_str(), m_sPassword.c_str(), m_sDbname.c_str());
    p = m_pOCCIenv->createConnection(m_sUsername, m_sPassword, m_sDbname);
    LOGD("OCCIDbs::CreateConnectedConnection()  after createConnection()");
  }
  catch (oracle::occi::SQLException& sqlExcp)
  {
    LOGD("OCCIDbs::CreateConnectedConnection Error=%d : %s", sqlExcp.getErrorCode(), sqlExcp.getMessage());
    return nullptr;
  }
  catch (std::exception& e) {
    LOGD("OCCIDbs::CreateConnectedConnection exception: %s", e.what());
    return nullptr;
  }
  LOGD("OCCIDbs::CreateConnectedConnection after createConnection()");```
0

There are 0 answers