Confusion about database updates
From: Burhan Khalid (newsgroups_at_meidomus[dot)
Date: 04/12/04
- Previous message: David Harper: "Re: wsdd axis"
- Next in thread: David Harper: "Re: Confusion about database updates"
- Reply: David Harper: "Re: Confusion about database updates"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 12 Apr 2004 11:32:42 +0300
Greetings:
I'm developing an application that will be running on many different
clients, all connecting to the same database server (MySQL). The
application is still in its initial phase, and is a conversion from a
rather unmanagable PHP application.
I have a few concerns about updating databases. Currently, when a new
record is inserted, a unique id, which is auto-updated is generated in
the database. This works well, since there is very little possiblity of
two or more clients submitting a request at the same point in time.
The problem occurs when connection to the database server is lost.
In this situation, the application should still continue to work in
offline" mode, using either an internal database (hsqldb) or writing to
a XML file. I have not decided what yet. Now when the connection to the
database server is restored, how would I update the "main" database
server with records from each client?
Consider the following scenario :
User A and User B are both connected to the database server, and the
current record id is 200. Now the database connection is lost. Both User
A and User B create a new record (internally). Both now are on record id
201. When the database connection is restored, how would I insert the
records of both clients into the database? There cannot be two records
with the same primary key of 201.
I considered using a timestamp check and updating the database
accordingly. This however would not work because the record id is used
in other parts of the application, and it needs to be unique. Once the
record is generated (and printed), all references to that record are
made using its record id. If I were to change the record id the the
database, it would invalidate the printed copy.
Any suggestions, ideas?
Thanks again,
Burhan
- Previous message: David Harper: "Re: wsdd axis"
- Next in thread: David Harper: "Re: Confusion about database updates"
- Reply: David Harper: "Re: Confusion about database updates"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|