On Thu, 5 Oct 2000, Tiana Zhang wrote:
> The reason I think I have to put static keyword for the method is
> because my method is going to update the database by JDBC
> connection. I don't want multiple thread updating the database at
> the same time.
static should have nothing to do with this. static just controls
whether something is a class variable/method or an instance
variable/method. (If you don't understand the difference, you should
get a basic Java book.)
> Here is my code:
>
> public static synchronized String assignNum(String name, String uID, String
> requestType, String comment){
>
> String rID = "";
> try{
> rID = db.DBinsert(name, uID, requestType, comment);
> db.updateSeqNum(requestType);
>
> } catch (Exception e) {
> System.err.println(e.toString());
> }
> return rID;
> }
There's lots of information missing here. Like what is db? What do
its methods do? How is assignNum called? And do you have your
servlet implementing SingleThreadModel? There may be other relevant
considerations as well.
Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html