Results 1 to 3 of 3

Thread: Problems with concurrent ADO connections

  1. #1
    Guest
    Hi, I've been working on a multiuser application. (say 15 users) using Access2000 as a backend database. I connect to the database using the following connection string.
    ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & GetPath() & ";Persist Security Info=False"

    Where GetPath() returns the path to the database.

    Now everything works fine when a single application starts up and finishes loading. Another application can then start up and when it's done both applications work fine. My problem occurs when both applications start at the same time. One connects and it seems that while it is connecting to the database (during various form loads, I suppose when the adodc controls connect to the database) the other application just crashes. I suppose the one application is locking access to the database, refusing a connection for the other application.

    My question is, how do I bypass this i.e. prevent the other application from crashing. A solution would be to somehow detect that a connection can't be made and wait. But this could be slow. A more suitable solution would be for both applications or all 15 of them to connect to the database simultaneously.

    Some help/advice would be much appreciated.

    thanks

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You could put some error handling in there (On error goto...) to try to keep it from crashing or look into the State property of a recordset off hand I don't know when exactly you use it (I use data environments a lot) but it will tell you if you are connected, connecting, or closed maybe you could do something with that???

    It doesn't really help that much because it will only tell if THAT user is already connected or not but maybe some kinda:
    On error goto AmIconnected

    AmIconnected:
    if State=connected then
    it=all_good
    else
    it=looks_like_I_need_another_try
    end if

    Sorry I really wasn't much help but good luck.

  3. #3
    Guest
    Yes, I implemented a similar strategy. The error occurred on the various datacontrol's refresh methods during the load event of the different forms. I seems that while one datacontrol is doing a refresh the other instances of the apps can't lock or read the database. so i did a on error goto errhandler

    where errhandler loops for a random interval and then tries again. this solved the problem, but the locking message still pops up. I just need to find a way to stop that message from displaying.

    anyway thanks for the feedback.

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