Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7441573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:02:14+00:00 2026-05-29T11:02:14+00:00

jsp file which contains username & password which is processed at LoginServlet…this servlet does

  • 0

jsp file which contains username & password which is processed at LoginServlet…this servlet does the validation in Access db. but i m getting error

if username & password matches with the access db then the page redirect to flat_status.jsp

can any1 help me out..

    package Validate;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.*;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class LoginServlet extends HttpServlet{

    @Override
    public void init(ServletConfig config) throws ServletException
    {
        super.init(config);
            try
        {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        }
        catch (Exception ex)
        {
            System.out.println("Initialize connector string");
        }
        }
    @Override
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
                Connection conn;
    Statement st;
    ResultSet rs;
    PrintWriter pw = response.getWriter();
        String userName = request.getParameter("username");
    String password = request.getParameter("password");
        HttpSession session = request.getSession(true);
        response.setContentType("text/html");
            try 
            {
                conn=DriverManager.getConnection("jdbc:odbc:FBS");
                st=conn.createStatement();
                rs=st.executeQuery("select UserName,Password from user_login where UserName='"+userName+"' and Password='"+password+"'");
                while(rs.next())
                {
                    session.setAttribute("USerName",userName);
                    RequestDispatcher dispatch=request.getRequestDispatcher("/flat_status.jsp");
                    dispatch.forward(request, response);
                }
            st.close();
            rs.close();
            conn.close();
            } 
            catch (SQLException ex) 
            {
                  pw.println(ex);  
            }
        }

        }

Here is Exception i m getting in Browser window

java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T11:02:15+00:00Added an answer on May 29, 2026 at 11:02 am

    Always use PreparedStatement and Password is reserved keyword in Ms-Access.

      boolean userFound=false;
    
      conn=DriverManager.getConnection("jdbc:odbc:FBS");
      String sql="select [UserName],[Password] from user_login 
                                where [UserName]=? and [Password]=?";
      PreparedStatement st=conn.prepareStatement(sql);
      st.setString1(1,userName);
      st.setString1(2,password);
      rs=st.executeQuery();
    
      if(rs.next())
       {
        userFound=true;
       }
      st.close();
      conn.close();
    
     if(userFound)
      {
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

monitorUrl-- http://host03:8810/solr/admin/stats.jsp which contains this xml file. <?xml-stylesheet type=text/xsl href=stats.xsl?> <solr> <core></core> <schema>test</schema> <host>domain.host.com</host>
How to see the which JSP file contains the given UI element like textbox
i have coded a header file which contains a input textbox for search.this header
From JSP file accessed another JSP file which acts like java class, this used
I am trying to access an XML file from JSP on my Tomcat server.
I have a jsp page which contains the code which prints all files in
I have a JSP file which creates an Excel document. I want to dynamically
I've got a jsp file, which includes another jsp file to check some values
i coded a header file which includes some of tabs.this header file is include
I'm trying to create a servlet which loads FirstJSP.jsp in WEB-INF/jsp/FirstJSP.jsp I'm having a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.