Not sure how this is Tomcat related other than it looks like you are
working on a servlet, but what the hell:
Of course !rs.next() would work, as in return 'you are lucky', cause
I'll bet it's null/empty.
Try System.out.println'ing the request params after getting them into
the Strings, and construct the SQL command string and println it too
before it gets used at the query line. Then you can at least see a
little what is going on internally. Could be case, spaces, etc hosing
you up here. Never use request params without checking them for null or
invalid values first. And don't use *, specify the field names, it
won't help here but is good practice.
Uma Maheswar wrote:
> Hi,
> Please help me with this. Please see the code below. It doesn't work, if I give the
>correct id and password.But it works if I say (!rs.next()). The same type of
>programme worked for me in case of other tables. Could any one pls help me solve this
>problem.
>
> String id = req.getParameter("userid");
> String pwd = req.getParameter("password");
>
> ServletOutputStream sos = res.getOutputStream();
> rs = st.executeQuery("select * from uma where userid='"+user+"' and
>password='"+pwd+"' ");
> sos.println("<html><body bgcolor=lightyellow>");
>
> if(rs.next())
> {
>
> sos.println("you are lucky");
> sos.println("<input type='submit' value='Submit' name='submit'></p>");
> }
> else
> {
> sos.println("<h2>Get out of my site</h2>");
> }
> sos.println("</body></html>");
>
>
> }
> catch(Exception e)
> {
> e.printStackTrace();
> }
> }
> }
>
>
>
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>