Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Please help newbie with heap exception on SQLDisconnect
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; }
if (m_hdbc != SQL_NULL_HDBC)
{
RETCODE nRetCode; AFX_SQL_SYNC(::SQLDisconnect(m_hdbc));<---------EXCEPTION HAPPENSHERE
*************************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
![]() |
![]() |