Do not use the same connection object to do two queries, if u still want to
use the same connection object, create the second statement object when u r
done with the first statement object. I GUESS that might help. I too had the
similar problem and rectified that by above procedure but i do not rule out
any other better solutions.
----- 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