hai
whats the problem is you are retriving the details of other record before
retriving the first record thats why the invalid cursor state
if you want to do the same and retrive all details from the resultset before
you go to the second resultset
hope this helps
rs = statement.executeQuery(select * from something);
while (rs.next()){
retrive all the values
}
rs1=statement.executeQuery(select * from otherthing)
while (rs1.next()){
retrive all the values
}


Cheers
palanikumar

----- Original Message -----
From: Jennifer Feeney <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 07, 2001 5:56 PM
Subject: SQLException with Servlet.......


> Hi all,
>
> Could anyone tell me why the following code is generating an "Invalid
> Cursor State" response.
>
> I have read the Archives and have found similiar problems, have made
> the changes suggested in the archives, but it still doesn't work.
>
> Thank you to anyone in advance for your help, and also to all that
> have helped with my questions to date...Thank You!
>
> Below is the code, any help would be greatly appreciated.
>
> Code:
> ======================================================================
> =========
>
> try{
>
>                          Statement statement =
> connection.createStatement();
>                          String query = "SELECT Id FROM Details " +
>                                                         "WHERE
> Password = '" + password + "'";
>              Statement statement1 = connection.createStatement();
>                          String query1 = "SELECT Password FROM
> Details " +
>                                                         "WHERE Id = "
> + id ;
>
>                          ResultSet rs = statement.executeQuery(
> query );
>
>                          rs.next();
>                           int idT = rs.getInt("Id");
>
>                          ResultSet rs1 = statement1.executeQuery(
> query1 );
>                          rs1.next();
>                          String passwordT = rs1.getString("Password");
>
>
>                          int x = passwordT.compareTo(password);
>                          int y = Integer.parseInt(id);
>
>
>                                 if(x == 0 && idT == y){
>
>                                 output.println( "<H1><Font
> color:Red>Welcome to our Online Service!</FONT><BR></H1>");
>                         output.println(getServletInfo());
>
>                         }
>
>                         if(x > 0 ){
>                                  output.println( "<H1><Font
> color:Red>Incorrect Password!</FONT><BR></H1>");
>                                 output.println( "<BR><BR><H1><Font
> color:Blue>Please click the, Back, button and try again!
> </FONT><BR></H1>");
>                         }
>
>                         if(idT != y){
>                                 output.println( "<H1><Font
> color:Red>Incorrect Id Entered!</FONT><BR></H1>");
>                                 output.println( "<BR><BR><H1><Font
> color:Blue>Please click the, Back, button and try again!
> </FONT><BR></H1>");
>                         }
>
>
>                      statement.close();
>                      statement1.close();
>               }
> ======================================================================
> ==================
> Code End.
>
>
> Thanks again, for your help.
>
> Best Regards,
> Jennifer
>
>
> _____________________________________
>
> Get your free E-mail at http://www.ireland.com
>
>
___________________________________________________________________________
> 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
>

___________________________________________________________________________
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

Reply via email to