List:General Discussion« Previous MessageNext Message »
From:murthy gandikota Date:January 2 2007 2:14pm
Subject:Re: JSP/JSTL problem
View as plain text  
Here is the code:
  ps = con.prepareStatement("select first, last from cust where ssn=?");
        int ssnint = Integer.parseInt(ssn.trim());
        ps.setInt(1, ssnint);
        ResultSet rs=ps.executeQuery();
        if ( rs.next()) {
                rs.close();
                out.println("Customer already exists " + Integer.parseInt(ssn));
                return;
        }
   
  do  insert (not shown)
   
  I get the message "customer already exists" for EVERY ssn that I tried.
   
   
   
  

Hassan Schroeder <hassan.schroeder@stripped> wrote:
  On 12/30/06, murthy gandikota wrote:
> I am getting the same result in Java code, i.e. the resultset returned is
> non-null even though the primary key value is not found in the table.

Without seeing code, it's hard to say -- but I'll just guess that you're
assuming an *empty* ResultSet is a null object, and that's simply not
true.

HTH,
-- 
Hassan Schroeder ------------------------ hassan.schroeder@stripped


 __________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
Thread
JSP/JSTL problemmurthy gandikota29 Dec
Re: JSP/JSTL problemmurthy gandikota30 Dec
Re: JSP/JSTL problemmurthy gandikota2 Jan
Re: JSP/JSTL problemmurthy gandikota3 Jan
  • Re: JSP/JSTL problemDavid Griffiths3 Jan
    • Re: JSP/JSTL problemmurthy gandikota4 Jan