Hi all,
I have an application which I did not write, but I want to improve it's
performance (Obviously I do have the code).
First of all I am not a database expert so my terms may not be exact, I
appologize

)
The application starts by reading a lot of data from the database tree
via ODBC (MFC + VC++ 6.0).
This process takes a few minuets, and I have more than one CPU, so
obviously I was thinking of multi-threading.
The point is that once I Multi-threaded the code, the program stuck
during startup. Looking with a debugger, I saw that all threads are
hanging while reading the DataBase. A code example is attached at the
end.
The problem persists even if I open the program twice (with the
original code !!), so it looks to me that the Databae/ODBC can not be
opened twice.
I thing that the problem is that I need to open the DataBase with
multiple read permision. How do I do that ?
More details regarding how do we load the data :
We read one table, the data of this table (Actually it's one of the
columns ) leads to read more tables, which leads to read more tables.
The whole code looks like million loops of the following example :
char achFilter[100];
CBlockSpecSet blockSpecSet(m_pDoc->m_pDB);
sprintf(achFilter,"lBlockID=%d", m_lId);
blockSpecSet.m_strFilter = (CString)achFilter;
TRY
{
if (blockSpecSet.Open())
{
while (!blockSpecSet.IsEOF())
{
m_SpecificsArray.Add((CSpecific*) new
CSpecific(
blockSpecSet.m_strFieldName,
blockSpecSet.m_strFieldDescription,
blockSpecSet.m_dValue));
m_nNumOfSpecifics++;
blockSpecSet.MoveNext();
} // while
} // if blockSpecSet.Open()
} // TRY
CATCH(CDBException, e)
{
AfxMessageBox(e->m_strError);
}
END_CATCH
blockSpecSet.Close();
Last thing is the following definition:
CDatabase* m_pDB; // Pointer to the Simulator
database. (File_DB.mdb)
Thanks
Maurice