Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Occi 12.1 Segmentation fault when trying to fetch data using instant client

3194571Oct 20 2017 — edited Oct 20 2017

I have a code:

class StatementPtr {

  Connection* connection_;

  Statement *statement_;

public:

  StatementPtr(Connection* connection, const string& sql): connection_(connection) {

    statement_ = connection->createStatement(sql);

  }

  Statement* operator->() {

    return statement_;

  }

  ~StatementPtr() {

    connection_->terminateStatement(statement_);

  }

};

const string kShowTables = "SELECT table_name FROM user_tables";

unordered_set<string> fetchAllTables(Connection* connection) {

  StatementPtr stmt(connection, kShowTables);

  ResultSet *result_set = stmt->executeQuery();

  unordered_set<string> tables;

  while (result_set->next()) {

    string table = result_set->getString(1);

    cout << "Found user table: " << table << endl;

    tables.insert(table);

  }

  return tables;

}

I was able to create environment and connection. However the first next() call causes segmentation call. Status of the call stmt->executeQuery() shows that the data is available.

Stack trace:

kpudfn2() at 0x7f3226a56590

OCIDefineByPos2() at 0x7f3226a16f8b

oracle::occi::ResultSetImpl::doOCIDefine() at 0x7f321eb02cdf

oracle::occi::ResultSetImpl::allocDefineDataBuffer() at 0x7f321eb01777

oracle::occi::ResultSetImpl::next() at 0x7f321eafde06

fetchAllTables() at oracle_utils.cpp:21 0x7f322d874c93

Does anyone veha an idea why it happens?

I use oracle instant client 12.1 to connect to oracle database 12c.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 17 2017
Added on Oct 20 2017
0 comments
816 views