Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Locking Oracle record whilst viewing page?

Status
Not open for further replies.

MarkEmerson

Programmer
Jul 10, 2003
35
GB
Hello people,

quite an obscure request here but i'm desperate :)

Does anyone know of / can think of a way in which it is possible to lock an oracle record for the duration of a page being open.

I know you can lock the record using the "select for update nowait" sql commands but this obviously releases the lock when the recordset is closed.

Any ideas how i can maintain this lock?

M
 
Hi,
Why?

Usually locking a record should only last as long as is absolutely needed for updating purposes..

What are you trying to accomplish? As you are aware, as long as your session is open, the data you see will not change, regardless of any updates that may occur.



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Web applications are stateless... the server has no clue what is going on with the client beyond whatever can be inferred from its most recent HTTP request.

It would be a shame to hold a record in a locked state, only to time-out 20 minutes later because the browser window had been closed.
 
Basically i am developing a web based front end for a third party product which we bought in. This product is a desktop install with a huge footprint and is not very user friendly.

The desktop application checks to see whether a record is locked when it is opened and if it is will tell the user that it is currently being edited by another user and that it will open in read only mode.

This is what i am trying to replicate so that if someone is viewing the data on the webpage somebody else couldnt log in and change this data via the desktop app.

Hope thats a bit clearer?
 
Yes the web app will all be using the intranet for the time being
 
That nearly made sense! I mean the web app USERS will all be using the intranet
 
What happens if the browser crashes, or the user dumps the browser ? Then your record would be locked for good (or until someone actually unlocked it on the database).
Scary stuff to say the least.

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Yeah thats why I wouldn't want the server holding the locks.

Since the clients are all internal, you could move this functionality down to the browser by writing an ActiveX control. This is probably not such a good idea long-term because (1) that particular technology seems to be on the way out and (2) it doesn't scale well beyond your internal intranet.
 
Hi,
Why ( again, sorry, but I am trying to understand the business need here ) the need to :
This is what i am trying to replicate so that if someone is viewing the data on the webpage somebody else couldnt log in and change this data via the desktop app.


Oracle handles reading and writing of the same record at the same time, but the user viewing the data will not see any changes..Is it worth the extra risks/coding to prevent something that may not have any practical effect..Must the user be guaranteed that the data being viewed is 'live' as of that very moment?

[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top