Yes I already did , that  you might think I should. Now I am trying with MS
ACCESS...and new error came : SQLException: general error
I didn't found any error in my  sql syntax or jdbc code. jdbc code alone is
working perfectly..

On Fri, Apr 15, 2011 at 9:02 PM, Angel Java Lopez <ajlopez2...@gmail.com>wrote:

> One question:
>
> You should have an ODBC declaration named "rahul". It is declared for your
> user, or as a system odbc name? My guess, your Tomcat is running as a
> service, or under other user (not your user), and ODBC "rahul" Data Source
> name is only for your user.
>
> Is it the case?
>
> Did you solve the problem? How?
>
> Angel "Java" Lopez
> http://www.ajlopez.com
> http://twitter.com/ajlopez
>
> On Fri, Apr 15, 2011 at 7:04 AM, RAHUL RAJ <omrahulraj...@gmail.com>
> wrote:
>
> > 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