I am using OCCI with C++ to get data from Oracle. The code works well, however I noticed some performance decrease. This happens because in the rset->next() iteration some computation takes time. The impact of this delay is that the oracle connection pool has one connection busy. If concurrently requests demand the same computation, the maybe all connection in the pool will be BUSY.
Statement *stmt = conn->createStatement (sqlQuery);
ResultSet *rset = stmt->executeQuery ();
while (rset->next ())
{
//Slow computation takes time
compute()
}
stmt->closeResultSet (rset);
conn->terminateStatement (stmt);
env->terminateConnection (conn);
So my question is: Can I copy the Occi::ResultSet (using a shared pointer?) in order to close the connection AFTER the copy and do the computation after releasing the connection?
go_to_oracle( ResultSet &result) {
Statement *stmt = conn->createStatement (sqlQuery);
ResultSet *rset = stmt->executeQuery ();
copy_rset_to_result;
stmt->closeResultSet (rset);
conn->terminateStatement (stmt);
env->terminateConnection (conn);
}
my_method() {
ResultSet *result = NULL
go_to_oracle(result);
//here connection is closed, but we have the data
compute(result) // do this without have connection occupied
}
Any examples available on GitHub?