1. shared (database) file and multiple users
- Posted by Eik Jul 03, 2008
- 708 views
Hi, I'm trying to manage database so multiple users (at office local LAN) could make additional changes (add,edit,delete) but how should I do it? I mean: If I make some changes and other database users should see my changes, how can I make donation or relation so other users using same database can see that something is changed. It's not normal to make check in every minute to found something is changed or not. I wish that some module is guarding separatedly and if changes appear, then it sends donation to every active users about it.
2. Re: shared (database) file and multiple users
- Posted by ChrisB. Jul 03, 2008
- 730 views
Hi
Depends on the database you are using, but in most cases you have to lock and poll, especially over a windows or NFS LAN. Ie lock when writing (other users check for the locks, and can't edit until the lock is released), and poll, either on a regular basis, or when the user accesses the database to see if there are any updates.
You could write a little background deamon to constantly check for new data, but I would think that the best way to check would be for the users program to check whenever a significant action is performed.
I think that MySQL, Access, and postgress have some mechanisms to avoid concurrency (2 programs trying to write to the same database at the same time), but you have to be a little careful with sqlite, and I have no idea about eudatabase.
Chris
3. Re: shared (database) file and multiple users
- Posted by Eik Jul 03, 2008
- 717 views
Hi
Depends on the database you are using, but in most cases you have to lock and poll, especially over a windows or NFS LAN. Ie lock when writing (other users check for the locks, and can't edit until the lock is released), and poll, either on a regular basis, or when the user accesses the database to see if there are any updates.
You could write a little background deamon to constantly check for new data, but I would think that the best way to check would be for the users program to check whenever a significant action is performed.
I think that MySQL, Access, and postgress have some mechanisms to avoid concurrency (2 programs trying to write to the same database at the same time), but you have to be a little careful with sqlite, and I have no idea about eudatabase.
Chris
Yes I'm tryng using EDS database and I understand database locking/unlocking but main question is: how should I check, is there something changed. Every change in database can be detected if any user makes something, then little log file can be overwritten with date and time changes are done. But it means every user must all the time check the logfile to detect newer date and time from logfile. It means all the time some clientcomputers are connecting over LAN to chech logfile. Question is: is it possible to send some popup or mark to clientcomputer window that changes are available.
4. Re: shared (database) file and multiple users
- Posted by Michael Sabal Jul 03, 2008
- 705 views
Yes I'm tryng using EDS database and I understand database locking/unlocking but main question is: how should I check, is there something changed. Every change in database can be detected if any user makes something, then little log file can be overwritten with date and time changes are done. But it means every user must all the time check the logfile to detect newer date and time from logfile. It means all the time some clientcomputers are connecting over LAN to chech logfile. Question is: is it possible to send some popup or mark to clientcomputer window that changes are available.
In MySQL, SQL Server, and the like, this would be done using triggers. EDS doesn't have triggers built-in, but if all your transactions are going through a server program, it should be pretty simple to implement. If all the clients are accessing the same file directly, then you should design your database in such a way that every write to a data table also writes to index table. The index table would look like...
key = {timestamp,primary_key,action} data = {}
The clients would have to poll the index to determine if new data is available.
A better design, IMO, would be to use a client/server model, where the clients never communicate with the database directly. They must communicate with the server, who can then prioritize the transactions, and send callbacks to the clients when there is new data.
5. Re: shared (database) file and multiple users
- Posted by ChrisB. Jul 03, 2008
- 730 views
Hi
Index table is a good idea because it would be, and remain small. Its not much different to a poll file, but perhaps a bit more robust.
Using the client server model still doesn't remove the requirement for polling.
I think that what Eik wants is for the server (where the database is held), to send all the clients a signal that there is new data. Unfortunately, the clients are still going to have to have a program running (in the background) that listens for this signal - effectively polling I'm, afraid. Theres no way round it. You're going to have to have programs running on the clients that listen for signal. You could use that sockets library, and have a little program running on the server that sends info to the client sockets programs, this would avoid the need for writing to a specific file, or database table.
The little program on the server would still have to check for changes every few seconds or so. So you would still have to monitor the database in some way.
As with anything, there are probably a ton of different ways to do this, none wrong or right.
Chris