The problem with the private static int reckey variable is that if i stop and
re-start the web server , again i
will be doing the count from 0 ( instead of from where i actually left off from
the previous calls, before stopping the server ).

You are stating that natural order counts cause problems, in the long run. Can
you please elaborate on that.  Thankyou.

Cheers,
Amar..






"Campbell" <[EMAIL PROTECTED]> on 10/28/99 03:10:11 PM

To:   Amarnath Nanduri/IT/VANCPOWER@VANCPOWER, [EMAIL PROTECTED]
cc:
Subject:  Re:      Question that is puzzling me




I think this is what you are looking for: synchronize your servlet method...

you may want to create a private static int reckey variable accessible
through a public getRecCounter method (synchronized), rather than using the
natural order count, described. Natural order counts cause problems, in the
long run.

Phil

-----Original Message-----
From: Nanduri Amarnath <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Thursday, October 28, 1999 12:56 PM
Subject: Question that is puzzling me


>Guys/Girls ,
>     I am calling a servlet from a jsp. The servlet implements the
>SingleThreadModel.
>The servlet has a doPost() method that writes data to a table in the
database.
>The primary key
>for each row of this Table is got by counting the ( number of rows in the
Table
>+ 1 ).  This is done in the
>doPost() method. Also i am setting autoCommit() to false ( in the
Connection
>Object ) and doing either a
>complete commit() or a complete rollback().
>
>My question is... if different people hit this page simultaneously, will i
still
>be getting unique primary keys for every person
>(or) if not is there a better way to do it......... Thanks in advance.
>
>Cheers,
>Amar..
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
>FAQs on JSP can be found at:
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to