Hi i am getting this error in jdbc connection....
Is there anybody to help me out of this error........
Jsp ----> servlet ----->Sql Server 2000
i am using tomcat 5.5 and jdk1.5
java.sql.SQLExc eption: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
My coding is ............... ............... ...............
import java.io.*;
import javax.servlet.* ;
import javax.servlet.h ttp.*;
import java.sql.*;
public class Loginpage extends HttpServlet
{
public void doPost(HttpServ letRequest req,HttpServlet Response res)
throws ServletExceptio n,IOException {
res.setContentT ype("text/html");
PrintWriter out=res.getWrit er();
String username=req.ge tParameter("use rname");
String password=req.ge tParameter("pas sword");
try
{
Class.forName(" sun.jdbc.odbc.J dbcOdbcDriver") ;
Connection con=DriverManag er.getConnectio n("jdbc:odbc:ku mar","sa","sa") ;
Statement smt=con.createS tatement();
ResultSet rs=smt.executeQ uery("select * from login where username='"+use rname+"'and password='"+pas sword+"' ");
if(rs.next())
{
out.println("va lid user");
}
else
{
out.println("In valid User");
}
}catch(Exceptio n e)
{
out.println(e);
}
}
}
Is there anybody to help me out of this error........
Jsp ----> servlet ----->Sql Server 2000
i am using tomcat 5.5 and jdk1.5
java.sql.SQLExc eption: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
My coding is ............... ............... ...............
import java.io.*;
import javax.servlet.* ;
import javax.servlet.h ttp.*;
import java.sql.*;
public class Loginpage extends HttpServlet
{
public void doPost(HttpServ letRequest req,HttpServlet Response res)
throws ServletExceptio n,IOException {
res.setContentT ype("text/html");
PrintWriter out=res.getWrit er();
String username=req.ge tParameter("use rname");
String password=req.ge tParameter("pas sword");
try
{
Class.forName(" sun.jdbc.odbc.J dbcOdbcDriver") ;
Connection con=DriverManag er.getConnectio n("jdbc:odbc:ku mar","sa","sa") ;
Statement smt=con.createS tatement();
ResultSet rs=smt.executeQ uery("select * from login where username='"+use rname+"'and password='"+pas sword+"' ");
if(rs.next())
{
out.println("va lid user");
}
else
{
out.println("In valid User");
}
}catch(Exceptio n e)
{
out.println(e);
}
}
}
Comment