Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2002

    Question Unanswered: OCCI getString error in debug mode

    Hi all,

    we are having problems with OCCI::ResultSet::gestString(). My platform is VC++ 6.0 on Windows 2000 professional and Oracle

    We open the connection, perform the query statement and call getString() to get the value of a VARCHAR column. The code is dead simple (and it is taken from the occidml.cpp demo file shipped with Oracle9i).

    string nome;
    rset = stmt->executeQuery ();
    while (rset->next ())
    cout << "nome: " << nome << endl << flush;

    The call to getStream works fine the first time, but the second time causes an assertion failure in dbgheap.c, I guess while freeing the previous value of the string. Please find hereunder the dbgheap.c code section causing the failure:

    * If this ASSERT fails, a bad pointer has been passed in. It may be
    * totally bogus, or it may have been allocated from another heap.
    * The pointer MUST come from the 'local' heap.

    Everything works fine if I compile in release mode, both against mono and multi-threaded C++ runtime. The problem arises only when I try to compile in debug mode.

    I would be grateful to anyone could help us,
    thanks in advance.
    Antonio Leonforte.

  2. #2
    Join Date
    Aug 2007

    Red face Same problem


    I am having the same problem, using Oracle Database 10g Express Edition Release - Production.

    In my specific situation I am coding a method that has the purpose of extracting the structure of a table into some variables which will contain field name, type and size.

    The code snippet below works for some tables, for other ones it throws an assertion failure in dbgheap as stated by the previous poster. I am using MS Developer Studio 2003 under Win2K Pro and OCCI which accompanies Oracle 10g.


    #include <string>
    #include <iostream>
    #include <occi.h> //Include das bibliotecas do Oracle

    int main(int argc, char *argv[])

    oracle::occi::Environment* env = oracle::occi::Environment::createEnvironment(); //Cria o ambiente de acesso ao Oracle

    oracle::occi::Connection* conn = env->createConnection( "user", "pass" , "schema" ); //Conecta ao Oracle utilizando usuario, senha

    std::cout << "\n------------------------------------------------------------------------------\n" << std::endl;

    std::cout << "\t\t\tLayout da Tabela de Origem\n" << std::endl;

    oracle::occi::Statement* stmt = conn->createStatement(); //Cria um objeto de declaração e o associa à conexão do Oracle

    stmt->setSQL("select column_name, data_type, data_length from user_tab_columns where table_name='NFE'");

    oracle::occi::ResultSet *rs = stmt->executeQuery(); // Cria um objeto ResultSet e executa a query do objeto de declaração

    while (rs->next()) //Enquanto houver registro...
    std::string nome_campo = rs->getString(1); //Pega a primeira coluna do resultado e associa a váriavel.
    std::string tipo = rs->getString(2); //Pega a segunda coluna do resultado ...
    std::string tamanho = rs->getString(3);
    std::cout << "Nome Campo: "<< nome_campo << "|" << "Tipo:" << tipo << "|" << "Tamanho: "<< tamanho << std::endl;

    conn->terminateStatement(stmt); //Fecha o objeto de declaração.

    env->terminateConnection(conn); // Fecha a conexão ao banco.

    oracle::occi::Environment::terminateEnvironment(en v); //Fecha o objeto de ambiente.



    Best regards,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts