Confusion about database updates

From: Burhan Khalid (newsgroups_at_meidomus[dot)
Date: 04/12/04

  • Next message: Paul Thomas: "Re: Servlet To Java Application Communication"
    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


  • Next message: Paul Thomas: "Re: Servlet To Java Application Communication"

    Relevant Pages

    • Re: Confusion about database updates
      ... all connecting to the same database server. ... >> The problem occurs when connection to the database server is lost. ... Let the MySQL server do that when your client ...
      (comp.lang.java.databases)
    • Re: ADO Connection Timeout
      ... so what happens when a connection failure forces one station to revert ... to a local database? ... Further, you *will* have contention issues, Jet does not support record ... to the central server, but you are willing to live with periods where it ...
      (microsoft.public.data.ado)
    • Re: Synching between Access and MSSQL
      ... The clients will only be disconnected a matter of a few days in most cases ... The challenge is that the information has to be tracked in a main database ... Working out the details of how to keep the data synchronized and accomodate ... I found code to allow an ADO connection to a local Access database but now I ...
      (microsoft.public.access.externaldata)
    • Re: ADO Connection Timeout
      ... When the first test is run, the results are stored in the central database. ... to the central server, but you are willing to live with periods where it ... i.e. a local database or even a text file. ... to function until the connection can be restored to the server. ...
      (microsoft.public.data.ado)
    • Re: ADO Connection Timeout
      ... to the central server, but you are willing to live with periods where it ... i.e. a local database or even a text file. ... to function until the connection can be restored to the server. ...
      (microsoft.public.data.ado)