Results 1 to 3 of 3

Thread: Synchronizing Database Activities

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2004
    Posts
    49

    Question Synchronizing Database Activities

    Hi there,

    Anyone knows if there is any synchronizing keyword to be used with methods?

    For example, in java, we have the synchronised keyword.

    This synchronised keyword is particular useful during updates in database.

    For example, a client who run 2 browser at an e-commerce site.

    1) client enter order amount of 5 in Browser A

    but later change his mind and change the order amount to 6

    2) client enter order amount of 6 in Browser B

    upon loading of another page

    Browser A should reflect 6 instead of 5

    I don't really know how to explain here but hope someone can understand me.
    ______________________________________

    Warmest Regards,

    Lex
    ______________________________________



    :|: Don't Mess With The Predator :|:

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Synchronizing Database Activities

    It depends how your order system is set up.

    If you are using session variables to store the "cart", then that's going to be restricted to one browser session.

    If on the other hand you store the order in the server-side database - no matter what browser the user accesses the site through, they will always see the latest data at the time, since there is only one copy of it (on the server).

    So the user enters an order amount in browser A and confirms it - it gets stored down in the server database.

    User later accesses his order through browser B - the data is pulled up from the DB, the user can change it and save it back again. After reloading the order page in browser A, it will show the new amount.

    Is that the clarification you were after?

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2004
    Posts
    49

    Re: Synchronizing Database Activities

    Quote Originally Posted by penagate
    It depends how your order system is set up.

    If you are using session variables to store the "cart", then that's going to be restricted to one browser session.

    If on the other hand you store the order in the server-side database - no matter what browser the user accesses the site through, they will always see the latest data at the time, since there is only one copy of it (on the server).

    So the user enters an order amount in browser A and confirms it - it gets stored down in the server database.

    User later accesses his order through browser B - the data is pulled up from the DB, the user can change it and save it back again. After reloading the order page in browser A, it will show the new amount.

    Is that the clarification you were after?
    Not really...

    Maybe I should phrase it this way...

    2 Clients, Browser A and Browser B...

    Both at the same page... Sees the same stock available...

    Lets say the available stock quantity is 10, both browser A and B sees the stock quantity as 10...

    Client at Browser A orders exactly 10 and Browser B orders 1, but clicked the submit button at the same time... In this case, wont the stock available in the database now be -1?

    If there is a synchronised method to use in the method, client at browser A can call the method first, lock up the resource then release the method after it is done updating the database and later when client at browser B access the method, client at Browser B gets notified of the unavailability of the stocks...

    I hope this is a better explanation...
    ______________________________________

    Warmest Regards,

    Lex
    ______________________________________



    :|: Don't Mess With The Predator :|:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width