为什么连接数据库总是出错
已经把驱动添加到到tomcat的lib文件里面还有web-inf下的lib里面,可是还是有错<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" import="java.sql.*,java.sql.ResultSet"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<center>
<h2>访问数据库</h2>
</center>
<table border=1 align="center">
<tr>
<td>姓名</td>
<td>住址</td>
</tr>
<%
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/my","root","111111");
Statement sm=con.createStatement();
ResultSet re=sm.executeQuery("select * from my");
while(re.next())
{
%>
<tr>
<td><%=re.getString("name") %></td>
<td><%=re.getString("ads") %></td>
</tr>
<%
}
re.close();
con.close();%>
</table>
</body>
</html>
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:491)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)