× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



P,

It means that the first person to update gets the change. Anyone who retrieved
the record before the last update cannot update the record. An initial locking
update will not ever be fail-proof.  If you want to prevent someone from
updating a record that is in use I would lock the record (actually I would
not do this unless the application could not possibly recover or a lot of time
would be lost by the user) and provide a mechanism for the users to work
it out amongst themselves.

David Morris


>>> P.Goovaerts@Clipper.Be 10/08/01 09:10AM >>>

But this means that only the last user-in-row can update the record ?
I mean:
a) user1 reads record and sets userid
b) user2 reads record and sets userid
c) user1 tries to update but fail...
d) user2 updates the record.

What I want to do is
a) user1 reads record and sets userid
b) user2 reads record, get message that record is in use...
c) user1 updates the record.

This must be fail-proof!  When user1 switches-off his PC without closing
normally, the record must be freed!





                    "David Morris"
                    <David.Morris@plum        To:     <java400-l@midrange.com>
                    creek.com>                cc:
                    Sent by:                  Subject:     Re: JDBC - SERVLETS 
- JAVA - SQL
                    java400-l-admin@mi
                    drange.com


                    08/10/2001 16:59
                    Please respond to
                    java400-l






P,

I usually use an update counter for our web-apps.  Every time a record is
updated
a trigger bumps up the update count and sets a userid.  If the new record
image
update count does not match the presented update count, then a message is
returned stating who updated the record.

If you are concerned about exactly what was updated, you have to pass the
record
image and compare it to the current record image before an update is
performed.
I do this via a database wrapper/trigger combination. It does effectively
double the
amount of data passed to an update and forces a potentially large compare.

David Morris



>>> P.Goovaerts@Clipper.Be 10/08/01 07:41AM >>>
I have a webapp which allows a user to retrieve a record from our
AS400 using SQL 'and prepared statements'. I also can write / update
records in the database.
How do I handle 'record-locking'? As an RPG-programmer, I was lucky
that this is done by the AS400 itself.

Sure, I can add a statusfield 'locked Y/N'
- which can be changed to 'Y' when record is read
- which can be changed to 'N' when record is updated/deleted
But... when user reads a record (locked = 'y')
1) he can close the browser without doing the update...
2) he can keep the session open without doing anything...
3) the connection can be lost...
4) servlet-programming error can occur...

please advice...




As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.