Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Please help newbie with heap exception on SQLDisconnect

Please help newbie with heap exception on SQLDisconnect

From: Ms. Foo Bar <quietgoth_at_yahoo.com>
Date: 24 Sep 2001 13:24:10 -0700
Message-ID: <73251423.0109241224.5783b4e1@posting.google.com>


Hello,

Does anyone know why I would be getting an exception when closing an oracle database? The code is shown below. The exception occurs when the code gets to the statement below in DBCORE.CPP. If I come back up the call stack, I find out that the error was:

HEAP[myprog.exe]: HEAP: Free Heap block 3a36920 modified at 3a3740c after it was freed

This is Win2K using Microsoft ODBC Driver for Oracle. The database is Oracle8i Enterprise Edition Release 8.1.6.0.0 - Production
With the Partitioning option
JServer Release 8.1.6.0.0 - Production

Thanks for any info,
-Julie

void CDatabase::Close()
{

  ASSERT_VALID(this);
  // Close any open recordsets
  AfxLockGlobals(CRIT_ODBC);
  TRY
  {

     while (!m_listRecordsets.IsEmpty())
     {
       CRecordset* pSet = (CRecordset*)m_listRecordsets.GetHead();
       pSet->Close();  // will implicitly remove from list
       pSet->m_pDatabase = NULL;
     }

  }
  CATCH_ALL(e)
  {
    AfxUnlockGlobals(CRIT_ODBC);
    THROW_LAST();
  }
  END_CATCH_ALL
  AfxUnlockGlobals(CRIT_ODBC);

  if (m_hdbc != SQL_NULL_HDBC)
  {

     RETCODE nRetCode;
     AFX_SQL_SYNC(::SQLDisconnect(m_hdbc));<---------EXCEPTION HAPPENS
HERE
....
}
*************************Here is my code:***************************

try
{ // need to launch the ODBC dialog here by attempting to create a
database

   CDatabase DB;
   BOOL bValid = DB.OpenEx( "" );
   if ( !bValid )

      return FALSE;
   strDatasource = DB.GetConnect();
   DB.Close(); // ***this throws an exception which is not passed to my prog***
}
catch ( CDBException* pDBEx )
{

   AfxMessageBox( CRString::GetCDatabaseError_str( pDBEx->m_nRetCode, pDBEx->m_strError ) );
  pDBEx->Delete();
  return FALSE;
}
catch ( CMemoryException* pMEx )
{

   CString strErr = "Memory Exception", strBuf;    if ( pMEx->GetErrorMessage( strBuf.GetBuffer(256), 255 ) )

      strErr += ": " + strBuf;
    AfxMessageBox( strErr );
    pMEx->Delete();
    return FALSE;
}
catch ( ... )
{

   AfxMessageBox( "An unexpected exception was caught. Unable to open database" );

   return FALSE;
} Received on Mon Sep 24 2001 - 15:24:10 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US