Welcome to dbFreaks.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Trouble with Multi-Threading (VC++ opening Access via ODBC)

 
   Database Help (Home) -> Visual Basic -> ODBC RSS
Next:  [Microsoft][ODBC dBase driver]External Table is n..  
Author Message
zmau

External


Since: Jul 03, 2005
Posts: 1



(Msg. 1) Posted: Sun Jul 03, 2005 12:36 pm
Post subject: Trouble with Multi-Threading (VC++ opening Access via ODBC)
Archived from groups: microsoft>public>vb>database>odbc (more info?)

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 Smile)


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((CSpecifi­c*) new
CSpecific(
blockSpecSet.m_strFieldName,

blockSpecSet.m_strFieldDescrip­tion,
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

 >> Stay informed about: Trouble with Multi-Threading (VC++ opening Access via ODBC) 
Back to top
Login to vote
Display posts from previous:   
   Database Help (Home) -> Visual Basic -> ODBC All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]