求解java报错!sql server的三个jar包已经导入!
报错:(java.lang.ClassNotFoundException:com.microsoft.jdbc.sqlserver.SQLServerDriver)<%t...
报错:(java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver)
<% try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection conn= DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=web;", "sa", "06180812");
Statement stmt= conn.createStatement();
String sql="select * from person";
ResultSet rs= stmt.executeQuery(sql);
//定义 字符串
String username =request.getParameter("username");
String password =request.getParameter("password");
if(username.equals(rs.getString("name"))&& password.equals(rs.getString("password"))){
//登录成功的,跳转到main.jsp
//request.getRequestDispatcher("main.jsp").forward(request,response);
response.sendRedirect("mainpag.jsp");
}
else{
//跳转到login.jsp
//request.getRequestDispatcher("login.jsp").forward(request,response);
response.sendRedirect("0login.jsp");
}
}
catch(Exception e){
e.printStackTrace();
}
%> 展开
<% try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection conn= DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=web;", "sa", "06180812");
Statement stmt= conn.createStatement();
String sql="select * from person";
ResultSet rs= stmt.executeQuery(sql);
//定义 字符串
String username =request.getParameter("username");
String password =request.getParameter("password");
if(username.equals(rs.getString("name"))&& password.equals(rs.getString("password"))){
//登录成功的,跳转到main.jsp
//request.getRequestDispatcher("main.jsp").forward(request,response);
response.sendRedirect("mainpag.jsp");
}
else{
//跳转到login.jsp
//request.getRequestDispatcher("login.jsp").forward(request,response);
response.sendRedirect("0login.jsp");
}
}
catch(Exception e){
e.printStackTrace();
}
%> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询