Also, when doing the update, set only the columns which the user has actually
changed. For this, you will have to save a copy of the unmodified values.
When constructing your update statement, include only those columns which have
actually changed. That way, you won't gratuitously change columns that another
user may have changed.
cc
"Radhakrishnan, Sanjay" wrote:
> When you do the update you would have to include all the modifiable columns
> in the where clause for the update statement.
>
> IF you have cols A, B, C, D, E & F
>
> and lets say only A B & C are updateable by any user.
>
> then you would select a,b,c,d,e,f from table
>
> the user would make the changes to columns(corresponding gui controls on the
> webpage(s)) then you would have to fire the update statement.
>
> update <set values>
>
> from table
> where a = <original retrieve value of a>
> and b = <original retrieve value of b>
> and c = <original retrieve value of c>
>
> consider this scenario where
>
> User 1 retirieves a record from the database at lets say 3pm
> User 2 retrieves the same record at 3:05 pm
> User 2 updates the record at 3:10 pm
> User 1 tries to update at 3:12 pm
>
> Now if User 1 hits the update button(and fires the above update statement
> the update will fail(ie. will not affect any rows) as the original values
> retrieved by user 1 have already been changed by user 2.
>
> HTH
> Sanjay
>
> -----Original Message-----
> From: Chee Keong [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 17, 1999 12:09 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Database locking in multiple page Web application
>
> Thank you for your response.
>
> Assume that I use Oracle or Informix which supports
> SELECT FOR UPDATE. However, I am still not sure how it would work
> across multiple web pages the the JDBC connection would be closed.
>
> The user would update the data on Page A and click a "Next Page Info"
> link. The user would then proceed to update data on page B., etc
>
> Finally, the use clicks Update . How can I prevent other users to
> be able to select the same record for update at the same time ?
>
> As I understand it, I would load the JDBC driver, connect to the
> database , perform some SQL statements and close off the connection
> withing the same JSP or servlet.
>
> Is the record still locked although my JDBC connection is closed and
> can I update this record in another JSP or servlet ?
>
> Regards,
> Chee Keong.
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JSP-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
> For JSP FAQ, http://www.esperanto.org.nz/jsp/jspfaq.html
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JSP-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
> For JSP FAQ, http://www.esperanto.org.nz/jsp/jspfaq.html
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
For JSP FAQ, http://www.esperanto.org.nz/jsp/jspfaq.html