PDA

Click to See Complete Forum and Search --> : Problems with concurrent ADO connections


Sep 15th, 2000, 01:25 PM
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

Edneeis
Sep 16th, 2000, 09:29 PM
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.

Sep 17th, 2000, 05:29 AM
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.