File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes about locks in servlets and in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "about locks in servlets and in JSP" Watch "about locks in servlets and in JSP" New topic

about locks in servlets and in JSP

nilima komala

Joined: Mar 03, 2005
Posts: 8
HI Every Body

I have one snippet that when user entered his details wrong for 3 times he would be restricted to log on to that by providing locks unless until the administrator allows him to access and this should be done by using tables in Oracle.
My question is how can we provide lock and release the lock in Servlets or in Jsp and how can we lock the resources by using the database.

Thank you in Advance

Best Regards,
[ February 19, 2006: Message edited by: Bear Bibeault ]
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1428
This should be moved to servlets / jsp forum.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

...and so it shall be

Please look for this thread in the Servlets forum.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33102

You would use JDBC to read/update a lock flag for each user in the Oracle database. When a user logs on, you would check this lock flag in addition to the password.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
nilima komala

Joined: Mar 03, 2005
Posts: 8
Thank you for your reply. Can you please explain it with an example sir please.

Once again thank you.

Best Regards,
dema rogatkin
Ranch Hand

Joined: Oct 09, 2002
Posts: 294
Are you using login feature of servlet/jsp container or provide own login procedure? In case of own login procedure locking a user shouldn't be a question, however when you use a container you have to be more creative. You can use a trigger if a contaner authenticate a user against a table in a database. However if your user repository is LDAP or some other directory you can either look how to setup number of failed attempts for a directory you use, or you can setup a filter which counts login attempt and locks login attempt for a blackouted user name. You can also restrict attempts of guessing user name count login attempt from certain IP, cookie and user agent.

Tough in space?, <a href="" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="" target="_blank" rel="nofollow">Check it here.</a><br /><a href="" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
I agree. Here's the link:
subject: about locks in servlets and in JSP
It's not a secret anymore!