473,513 Members | 2,454 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

preventing 2 simultaneous mysql update from a GUI

Hi out there,

I have problems finding a way to warn a user that
another user intends soon to update the same specific row.
Let me explain.

User 1 get to a JSP "update customer record" page.
- The page does a read of the existing record and
loads it into the gui fields for edit.

while he is doing is editing ... User 2 wants to update the same
"update customer record" page and attemp to load the same record in.
What mecanism can I use to stop him being able
to load the same record and warn him someone else is
updating that record.

It seems trivial but so far I don't know of a lock to stop
me reading a specific record. I must be missing something.

Thanks for your sugestion and specific sql examples.

Fred
Jul 20 '05 #1
3 3149
In article <ef**************************@posting.google.com >,
fl*********@hotmail.com says...
Hi out there,

I have problems finding a way to warn a user that
another user intends soon to update the same specific row.
Let me explain.

User 1 get to a JSP "update customer record" page.
- The page does a read of the existing record and
loads it into the gui fields for edit.

while he is doing is editing ... User 2 wants to update the same
"update customer record" page and attemp to load the same record in.
What mecanism can I use to stop him being able
to load the same record and warn him someone else is
updating that record.

It seems trivial but so far I don't know of a lock to stop
me reading a specific record. I must be missing something.

Thanks for your sugestion and specific sql examples.

Fred


I don't know about a lock but you could have a flag field that is set to
signify that the row is in use, that is reset when the updated record is
re written. I know it is brute force and ignorance.

I would also like an elegant solution to this problem.

Jul 20 '05 #2

"Richard Sanders" <ri*****@stardate.ca> wrote in message
news:MPG.1b5e2e417226da69989686@shawnews...
In article <ef**************************@posting.google.com >,
fl*********@hotmail.com says...
Hi out there,

I have problems finding a way to warn a user that
another user intends soon to update the same specific row.
Let me explain.

User 1 get to a JSP "update customer record" page.
- The page does a read of the existing record and
loads it into the gui fields for edit.

while he is doing is editing ... User 2 wants to update the same
"update customer record" page and attemp to load the same record in.
What mecanism can I use to stop him being able
to load the same record and warn him someone else is
updating that record.

It seems trivial but so far I don't know of a lock to stop
me reading a specific record. I must be missing something.

Thanks for your sugestion and specific sql examples.

Fred


I don't know about a lock but you could have a flag field that is set to
signify that the row is in use, that is reset when the updated record is
re written. I know it is brute force and ignorance.

I would also like an elegant solution to this problem.

I would recommend using a lock column in the table (or keep a separate lock
table) . The way I'd use it is that whenever anyone opens the record to edit
it, their name/ref is written to the lock field. When they post changes, the
script compares the lock field user ref with that of the person submitting
the changes and only perform the update if the users match. This way there
is no problem with users locking a record then not sending changes. If the
lock field and the user sending changes dont match, they could be sent a
brief summary of diffferences between their data and the data showing in the
table.

In addition you could also consider saving the original data (and re-send it
in hidden fields), compare it with the data in the table and flag an error
if it doesnt match.
Jul 20 '05 #3
Ok,

Thank you guys. I did think of something of the kind, but
I can't imagine there isn't a way of stoping the user 2
before he acctually tries anny update.

Also I still haven't
found a way to lock a row agaisnt a read, which would get
me pretty close to a clean solution. I can lock against
update but can't see why I shouldn't lock a row against
a read.

Anyone knows of a precise reason to use a Read for update?

thanks,

Fred
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
9121
by: Martin Lucas-Smith | last post by:
Can anyone provide any suggestions/URLs for best-practice approaches to preventing SQL injection? There seems to be little on the web that I can find on this. Martin Lucas-Smith ...
2
2029
by: opt_inf_env | last post by:
Hello, I would like to solve the following problem. On the server side I have a file with a sequence of natural numbers (1, 2, 3, 4, 5, ...., n). Each user, after some action, adds new number...
5
613
by: Fred | last post by:
Hi out there, I have problems finding a way to warn a user that another user intends soon to update the same specific row. Let me explain. User 1 get to a JSP "update customer record" page....
1
2442
by: David Hane | last post by:
Hi all, I would like give users the ability to experiment with complex queries but I'm worried about them creating queries that will bog down the server. Does anyone have any ideas for...
0
1773
by: SimonC | last post by:
I'm looking to do something similar to a feature found on Ticketmaster.com, where you select your seats at a venue, and then you have two minutes in which to take or leave them. QUESTION 1a....
1
2435
by: slugger | last post by:
Hope this is not OT: I am running into some strange things whenever my ASP pages send out simultaneous requests to another ASP page which in turn gains access to a MySQL database using a DSNless...
1
2184
by: Edwin Grubbs | last post by:
Hello, I have experienced problems with postgres hanging when two inserts reference the same foreign key. It appears that the second insert is waiting for the first insert to release a lock....
3
6072
by: Juan Antonio Villa | last post by:
Hello, I'm having a problem replicating a simple database using the binary log replication, here is the problem: When the master sends an update to the slave, an example update reads as follows:...
0
11684
by: cwho.work | last post by:
Hi! We are using apache ibatis with our MySQL 5.0 database (using innodb tables), in our web application running on Tomcat 5. Recently we started getting a number of errors relating to...
6
38453
Atli
by: Atli | last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users. Anyone should be able to get...
0
7259
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7158
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7380
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7535
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5683
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5085
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
455
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.