Forum Stats

  • 3,741,304 Users
  • 2,248,409 Discussions


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

3194571 Member Posts: 16
edited Oct 20, 2017 5:40PM in Oracle Call Interface (OCI)

I have a code:

class StatementPtr {

  Connection* connection_;

  Statement *statement_;


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

    statement_ = connection->createStatement(sql);


  Statement* operator->() {

    return statement_;


  ~StatementPtr() {




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;



  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.

This discussion has been closed.