|
-
Jun 28th, 2006, 04:14 AM
#1
Thread Starter
Member
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 :|:
-
Jun 28th, 2006, 04:35 AM
#2
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?
-
Jun 28th, 2006, 09:22 PM
#3
Thread Starter
Member
Re: Synchronizing Database Activities
 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|