CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 1999
    Posts
    92

    Database and threads

    I am using a thread to put information into a database, but the app crashes after the first string is entered. So I only get one line into the database. How can I fix this problem of CDaoDatabase object and multithreads. I am using vc4.2


  2. #2
    Join Date
    Apr 1999
    Posts
    5

    Re: Database and threads

    My co-workers and I have discovered that DAO, Access, and the Jet DB Engine are not thread safe at all.

    I don't know if this could be your problem, but I might I suggest that you need to limit database access to one thread (in one process) at a time.

    In other words, don't have tables open in the same MDB in multiple processes, or in multiple threads in the same process at the same time. It was never designed to handle that.



  3. #3
    Join Date
    May 1999
    Location
    Houston - TX - US
    Posts
    29

    Re: Database and threads

    Hi ,
    DAO is not thread safe ! but if U have aldreay developed ur appl using DAO n want to avoid much changes now , use mutex or so n see that only one thread opens the DB at a time n close it imm after it is done .
    And if U have made this a regular DLL I hope U must have called AfxDaoTerm();
    whereever necessary.

    Good Luck.
    Yash.


  4. #4
    Join Date
    May 1999
    Location
    Sydney, Australia
    Posts
    420

    Re: Database and threads

    There is a brilliant article on this site talking about DAO and threading
    take a look at it....

    sally


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured