Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Fabiana Ferrrari   on Feb 01 In Java Category.

  
Question Answered By: Varun Mehta   on Feb 01

Have u checked what u r getting in string  u1 and p1
and the second thing is that why u r using rs.next()
two times???

rs.next();
>
> while(rs.next())
>
> {

...
..
}
Don't fetch all records for authentication  you can
modiff your query like this one

String query="select count(*) from Registration where
user=u1 and password=p1;";
if(rs.next())
{
// if found 1 than user exists //rs.getInt..(1);
}
For better performance u can also go for
preparedstatement instead of statement.
if your code is for learning purpose than it is
OK......

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on problem in bean Or get search suggestion and latest updates.


Tagged: