I have a MySql (5.5) database with a MS Access frontend. If two users are viewing the same record at the same time how can I make each user aware of each other? For example how would I go about displaying a label indicating that another user is also viewing the same record?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
I may be wrong, but I don't think this is possible unless you restrict access to the data to be via stored procedures - then the procedure can trigger audit mechanism that you can expose to the users. You would also need polling of the audit if both users need to be aware.
This process will be a bit cumbersome for the DB. Not only do you want to know if the current record is being viewed, but you also want to notify the users of each other. When a user reads a record, the DB system quickly fetches the data and returns it to the user. As far as the DB is concerned, once the data is sent to the client, nobody is 'viewing' said record. From the application side, the user might still be reading the details, but the DB has finished its part. This whole process can be completed in micro seconds by the DB.
To handle the real life process, the front end application will need some sort of 'finished reading' button to explicitly notify other users (the DB is not concerned as it had done its part).
This is what I could think of quickly. If there is a more efficient method, please let me know.