Hello,
     I am working on  building a jsp website with MS Access as
database. When my login page is loaded on tomcat
(localhost:8080/login.jsp), it shows the following error:

java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source
name not found and no default driver specified.

The jdbc program alone is working perfectly, So There might not be
problems due to  Driver, Data source name, Database Tables or any
other software version compatibilities.

OS: Windows Vista Home Basic
Tomcat Version: 5.5.x
jdk version: 1.6
MS Access 2010


code is given below:

<%@ page language="java" import="java.sql.*" %>
 <html>
 <body>
 <form method="post">
 <p> Enter your username :  <input type="text" name="username"/> </p>
 <p> Enter your password :  <input type="text" name="password"/> </p>
 <input type="submit" value="Login"/>
 <%
    String usn = request.getParameter("username");
        String pass = request.getParameter("password");

        try{
                 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                 String url = "jdbc:odbc:rahul";
                 Connection con = DriverManager.getConnection(url, "", "");
                 Statement s = con.createStatement();
                
                 ResultSet rs = s.executeQuery("select * from customers");
                 while(rs.next())
                 {
                   String u = rs.getString(1);
                   String p = rs.getString(2);
                   if(usn.equals(u) && pass.equals(p))
                   {
                      out.println("login successfull");
                          }
                   else
           {
              out.println("login failed");
             }
           }
        }
                
                catch(Exception e)
                {
                   out.println("Error"+e);
                   }
                        
 %>
 </form>
 </body>
 </html>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to