ODBC and JDBC cursors are not working in the same way. So while
executing the code, it wont give you any error message, but
produce wrong results. Here after the while loop, the recrodset
will be pointing to a null record and that's why the result is
wrong. Rewrite the code as below:
while (rs.next()) {
correctpass =3D rs.getString("USER_PASS");
if(correctpass.equals(password))
{
iscorrect =3D true;
}
else {
iscorrect =3D false;
}
}
or even this will work:
if rs!= NULL
rs.next()
correctpass =3D rs.getString("USER_PASS");
if(correctpass.equals(password))
{
iscorrect =3D true;
}
else {
iscorrect =3D false;
}
}
Regards,
Manoj.
Here is my code for my servlet which goes to a database and
checks to =
see if the password has been entered correctly.
String query =3D "SELECT * FROM USERS WHERE USER_USERNAME =3D '"
+ =
username + "'";
ResultSet rs =3D stmt.executeQuery(query);
while (rs.next()) {
correctpass =3D rs.getString("USER_PASS");
}
if(correctpass.equals(password))
{
iscorrect =3D true;
} else {
iscorrect =3D false;
}
return iscorrect;
Correctpass results in a NULL. This code works fine when I run
it as a application. Is there some sort of security issue, I
dont know about ? I thought that servlets worked on the same
security system as = applications.
Thnx for the help in advance.
Keith
___________________________________________________________________________
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