473,672 Members | 2,597 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 3171
In article <ef************ **************@ posting.google. com>,
fl*********@hot mail.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*****@starda te.ca> wrote in message
news:MPG.1b5e2e 417226da6998968 6@shawnews...
In article <ef************ **************@ posting.google. com>,
fl*********@hot mail.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
9132
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 www.geog.cam.ac.uk/~mvl22 www.lucas-smith.co.uk Senior Computing Technician (Web Technician) Department of Geography, University of Cambridge (01223 3)33390
2
2045
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 (n+1, where n is the last number in the file) to the end of file. To do this user has to open the file for reading, read the last number, perform corresponding manipulations with the extracted last number and add result to the end of the file...
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. - The page does a read of the existing record and loads it into the gui fields for edit.
1
2444
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 preventing a runaway process? I'd like to empower my users AND keep my server online :-) Thanks!
0
1780
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. Inside (or just after) the same query that searches for available seats, I need to SIMULTANEOUSLY mark those seats as "on hold". I've only read about, but not yet used MySQL transactions, and wonder if this simultaneous "search-and-hold"...
1
2439
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 connection string. Whenever I run a page that just puts out a single request things seem to go fine, but if I activate some Flash components that reside on my ASP pages that put out requests to ASP pages which in turn try to retrieve data from...
1
2201
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. Here is an example of how to recreate the problem. Please ignore the lack of sequences, since that is irrelevent to the problem. I have tested this under pg 7.4.3. ----------------------------------------------------------
3
6084
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: UPDATE MainInfo SET dAddress='38 Holland Blvd', dCity='miami', dState='FL', dZip='33000', dCountry='USA', dPhone='999987565', dNum='AC15857', dName='Michael A Scott' WHERE did=22'
0
11696
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 java.sql.SQLException: Deadlock found when trying to get lock; Try restarting transaction message from server: "Lock wait timeout exceeded; try restarting transaction"; We get such errors generally on inserts or updates while applying a
6
38497
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 through this without much trouble. Programming knowledge is not required. Index What is SQL? Why MySQL? Installing MySQL. Using the MySQL command line interface
0
8486
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8404
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8931
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8608
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8680
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5705
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4418
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2819
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1816
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.