473,385 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 3135
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
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
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
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
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
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
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
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
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
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
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...

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.