jsp连接mysql的问题
下面是代码:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
String url ="jdbc:mysql://localhost/shujuku1?user=wxn&password=123";
Connection conn= DriverManager.getConnection(url);
Statement stmt=conn.createStatement();
String sql="select * from biao";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) {
%>
您的第一个字段内容为:<%=rs.getString(1)%>
您的第二个字段内容为:<%=rs.getString(2)%>
<%}%>
<%out.print("数据库操作成功,恭喜你");%>
<%rs.close();
stmt.close();
conn.close();
%>
</body>
</html>
报错是:
javax.servlet.ServletException: Communication failure during handshake. Is there a server running on localhost:3306?
但是我的mysql已经启动了,并且已经在shujuku1里面建立了biao这个表,不知哪里还有问题。
敬请赐教!