Solved

Problem with multithread access.mdb

Posted on 2003-10-27
4
360 Views
Last Modified: 2013-11-20
Hi,
   i have three threads each with a CDaoworkspace, CDaoRecordSet objects. The dao's looks at the same database. I create three workspaces i append them and make setisolationODBC=true for multi connection. I do not make begintransaction and committransaction because i have problem with the requery and addnew. After continously 10000 transactions i have unhandled exception in dao.dll. Any ideas?
0
Comment
Question by:ttsenis
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
migel earned 50 total points
ID: 9626026
Hi!
did you read this article in the MSDN
"PRB: Thread Safety for DAO/Jet"
PSS ID Number: 169395
or Q169395
?
0
 
LVL 4

Expert Comment

by:inox
ID: 9626610

Hi,
DAO is not threadsafe.

Syncronize with mainthread or use ADO instead.

P.S:
To all who think it works:
I know it (seems to) work, but
DAO is not threadsafe.
I know it (seems to) work 10, 100, 10000 times , but
DAO is not threadsafe.
I know Jet Engine ist threadsfe, but
DAO is not threadsafe.
and if you want to make CDAO objects threadsafe by marshalling, forget it

0
 

Author Comment

by:ttsenis
ID: 9642318
I did put the ADO com and i almost found everything ok, except i have problem with the AddNew and the UpDate. They introduce a VARIANT input for FIELDS and the VALUES. Any idea how the input variant inputs should include the fileds and the values (just the name or the IDispatch). Any example for MFC and the ADO com?

   Regards,
     Teo.
0
 
LVL 4

Expert Comment

by:inox
ID: 9643425
Hi Teo,
you must specify specific cursor- and locktype to modify or append, maybe that's the problem i.e:

_RecordsetPtr g_pRs = NULL;
_variant_t v;
long l;

TESTHR(g_pRs->Open ("Table1",strCnn,adOpenKeyset,adLockOptimistic,adCmdTableDirect));
TESTHR(g_pRs->Seek(_variant_t(1L),adSeekFirstEQ));
v=g_pRs->Fields->Item["ID"]->Value;
l=v.lVal;

0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Process filename extension 3 186
difference between String.subString() and String.subSequence() 6 200
tripleUp challenge 7 79
fix34  challenge 9 121
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question