Solved

URGENT !!!  Using 2 executables to access the same ".mdb" file

Posted on 2000-05-11
8
182 Views
Last Modified: 2013-11-20
Dear Experts,

The situation is like this - I have written a server that keep track of some information (coming from the I/O port). This information is stored under an ".mdb" file - say "ABC.mdb"

Everything is fine until I want another executable to access "ABC.mdb" for informatin retrieval.

There will be an error message prompting "Cannot be updated : ABC.mdb is being locked by another program".
I guess this is because I am already using the server program to access the ".mdb" file and it will update the database whenever new information arrives.

I need your help and advices!!!!!
So how can I overcome this "locking" problem and fullfil the goal of constantly updating the file, while allowing information retrival at the "same time".
Any suggestions and comments are welcome. Your help is much appreciated.

As my customer is small business - so it would not be possible to provide them with a server solution (in business point of view).

Best Regards,
Eric
0
Comment
Question by:e1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 3

Expert Comment

by:_mb_
ID: 2803318
How do you open the database? I think one of your executables (or both) opens the mdb-file using an exclusive mode.
0
 

Author Comment

by:e1
ID: 2803334
No, I did not use exclusive mode.
0
 
LVL 7

Expert Comment

by:tchalkov
ID: 2803527
You said that your customer cannot afford a server solution but this is not quite true - if you are using Visual Studio to write your application then you have the write to distribute free MSDE (Microsoft data engine) with your application which is in fact the engine of SQL Server. You work with it the same way you work with SQL Server.

So probably you could think of this possibility
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:e1
ID: 2809447
Hi tchalkov,

If I am using Visual C++ 5.0 Professional Edition to develop my application and using the Microsoft Jet Database to perform different database operations previously, can I change my current project to use the Microsoft Data Enginer.

If yes, is there any example availiable?

Thanks!!!
0
 
LVL 7

Expert Comment

by:tchalkov
ID: 2809680
It is free only for Visual Studio 6.0 Professional or Enterprise (for the whole suite , not only VC++)
more information you can get on www.microsoft.com/vstudio
0
 

Author Comment

by:e1
ID: 2816736
Thanks tchalkov.

My company has VC 5.0; so could not try the suggested MSDE. We are trying to figure out some other ways to overcome this problem.

But if there is no further comments coming at around Friday, then I will award the points to you for your help.

So if I could not use MSDE, do you have any better ideas?
0
 

Accepted Solution

by:
wraith0 earned 500 total points
ID: 2823996
A suggestion:
For both the server and the client apps, put the connect statement inside a loop that checks for success.  

It will keep attempting to connect until the lock on the file is removed, and then it will succeed.  

If your server app is only getting data intermittently, then it should disconnect after it updates the database.  The client should do the same as well.

This will slow down the app a bit, but for a small business not willing to purchase SQL Server....anyway.

Hope it helps.  
0
 

Author Comment

by:e1
ID: 2832036
Finally we have solved the problem by catching the exception of "Update" - and retry to Update until it has successful OR it has failed for more than N times.

I would like to thank both wraith0 and tchalkov for their help. It seems, in this case, wraith0's solution is more appropriate (as I only have VC++ 5.0). So I would like to give the points to wraith0.

Thanks to both of you again.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
maxBlock challenge 30 151
lucky13 challenge 11 167
Unix Command -- Challenging  question 7 106
Problem to event 3 123
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

739 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