473,382 Members | 1,635 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,382 software developers and data experts.

Lock DB record or Lock JSP page record/button

Dököll
2,364 Expert 2GB
Hey Ladies and Gents!

I would like to permit only one user edit to a row in a database. I am a firm believer at having the db do most of the work but the app I am maintaining could use some robustness; as a couple of users were picked up to have updated the same record, at the same time.

Do you think locking the database per user instance (which I have no idea about, as of yet) is a better approach than locking/disabling the update button based on the JSP page opened (EditEmployeeItems.jsp)...

Got some links on locking through DB:

http://www.vsj.co.uk/databases/display.asp?id=522

http://articles.techrepublic.com.com...1-5181472.html

http://www.sqlmag.com/Article/Articl...ver_25916.html

If you could provide better links that'll help me achieve this through the DB that'd be great

+++++++++++++++++++++++++++++++>>

My other option is:

(1) read the user's IP, who frst loaded EditEmployeeItems.jsp
(2) submit the date/time the page is retrieved
(3) compare with today's date/time
(4) lock/disable the update button on that page,
(5) throw a message to user that page is being updated

Expand|Select|Wrap|Line Numbers
  1. public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
  2.  
  3.         // Get User IP
  4.         String UserIP = req.getRemoteAddr();    
  5.  
  6.     } 
  7.  
  8.  
...

below may be incorrect, but that's the idea I am attempting...

Expand|Select|Wrap|Line Numbers
  1.  
  2. ....
  3.                int UserName=rs.getInt(1);
  4.  
  5.  
  6.             session.setAttribute("UserName",UserName);
  7.             session.setAttribute("LogTime",LogTime); //date/time auto populate
  8.  
  9.             String queryString = "INSERT INTO RETRIEVEDJSP set UserName="+UserName+",LogTime='"+LogTime+"'"; //submit an Autodate (java.sql)
  10.  
  11. ....
  12.  
I could also simpy disable the link to the page, and avoid having to read user attempts to edit, unless it is the first instance.

What are your thoughts? Thanks for your much needed response.

In a bit!

Dököll
Nov 22 '09 #1
1 3186
Dököll
2,364 Expert 2GB
any ideas guys!

I have researched the articles, gives me something to work with. But I could not find anything about the benefit to using one option over the other.

Any input you have is helpful.

Thanks for your help...
Dec 3 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Andy | last post by:
newbie question here--- In Table1 I have basic membership information. Table 2 is 'event' information. I have a form for Table2 with a combo box, where the user will pick a member from Table1, and...
6
by: Tony K | last post by:
I have the most peculiar problem with an ASP.NET page which we use for downloading a file. When the user clicks on a link, the link points to an ASPX page which downloads the file selected. ...
11
by: John A Grandy | last post by:
asp.net 1.1 ie 6 how to lock-out the user from clicking the browser "Back" button ?
1
by: Joe | last post by:
Hi, I have an asp.net page that opens up a connection to MS access DB and does insert into DB. I am using close() and setting the connection object to Nothing after I am done with inserting a...
2
by: shenanwei | last post by:
DB2 V8.2 on AIX, type II index is created. I see this from deadlock event monitor. 5) Deadlocked Connection ... Participant no.: 2 Lock wait start time: 09/18/2006 23:04:09.911774 .........
0
by: sagarp86 | last post by:
How to lock / deactivate "Refresh" and "Back" button on browser. Problem is in voting application. Once we click for a vote application goes to next page and increament one vote in the database....
2
by: brino | last post by:
hi all ! i have a data entry form and the problem i have is that the users when they are entering data in grab the mouse and accidently move the roller on the mouse and move to a new record on...
5
by: prakashwadhwani | last post by:
The Delete Event/Proc & "Save_Fields_In_Form_Header" Event/Proc in my form were working perfectly. However, after I added a call to the "Save_Fields_In_Form_Header" Event/Proc in the...
6
by: Mark | last post by:
Currently using MS Access 2000 and SQL Server Express. Using the current DAO OpenRecordset code listed below, however I keep getting the error message.... 3254: ODBC --Cannot lock all records ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.