473,796 Members | 2,864 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Lock DB record or Lock JSP page record/button

Dököll
2,364 Recognized Expert Top Contributor
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 (EditEmployeeIt ems.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 EditEmployeeIte ms.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 3210
Dököll
2,364 Recognized Expert Top Contributor
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
1932
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 then fill in the rest of the data. My question is this - I fear the combo box will be used incorrectly - that is, they will use it to 'find' a record. Click on the drop down box and make a selection. However doing that of course does not find a...
6
3019
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. The code works fine except after the user saves the file, the links on the left side of the frameset do not work. IE locks up.
11
2703
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
2460
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 record. After inserting when I look at the server where the MS access DB resides I also see a *.ldb file also. For some reason I cannot get rid of this *.ldb file even after I close the connection to DB from my asp.net page. As long as this *.ldb file is...
2
5867
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 ...... Deadlocked Statement: Type : Dynamic Operation: Execute
0
3528
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. But when we click on "Refresh" button on the browser, the query is fired again and again one vote is added un-necessarily..Only one vote should be posted from each pc / user. Same thing is with "Back" button on browser. when we click on vote,...
2
2335
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 the form when they havent finished entering the original record in. how can i lock the form on the one record and not move to another record until the click the "save" button that is on the form ??? any help would be great !
5
3188
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 "Current" Event of my form, and I now try to Delete a record, I get ... Run-Time Error 3218 - Could not Update; Currently Locked. My Access application then effectively freezes forcing me to shut Access down & re-start. The record DOES get deleted...
6
6225
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 The code below runs in a MS Access frontend while the table is linked using an ODBC connected to an SQL Server (backend). The table (located in SQL) only has one row and one column within it . I want to try and stop any other request (other...
0
10221
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10169
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
10003
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
9050
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6785
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
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5569
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4115
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
3
2924
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.