Results 1 to 5 of 5

Thread: jsp update

  1. #1
    Join Date
    Feb 2012
    Posts
    5

    Unanswered: jsp update

    int rs;

    rs=db.execSQL("select password from DB.LOGIN where username='"+user+"'");
    System.out.println("passwd selected");

    while (rs.next())
    {

    if(newp1.equals(newp2))
    {
    System.out.println("password equals");

    rs=db.updateSQL("UPDATE DB.LOGIN SET PASSWORD='"+newp1+'" WHERE
    }

    else
    {
    out.println("password must be same");
    }

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Do you have a question?
    George
    Home | Blog

  3. #3
    Join Date
    Feb 2012
    Posts
    5
    I am getting null pointer exception while performing the update operation in this code ...............

  4. #4
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    not knowing jsp at all - the question would be
    where do you set newp2 / newp1??
    where do you save the password from select ??
    look in sqllib/samples -- there are many samples if you don't know how to write the logic ..
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  5. #5
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    If the passwords are the same why do you need to update the table? Surely the data is not changing!

    You have an incomplete UPDATE statement (unfinished where clause, no closing quoting or brackets).

    There's a fair bit wrong with your code which makes me assume you've not posted the actual code you were working on. Post the real stuff along with any error messages and the lines upon which these errors are reported. Oh and most importantly what you want the code to do and why
    George
    Home | Blog

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •