JAVA 连接MySql出错
<%@ page contentType="text/html;l anguage=gb2312" language="java" import="java.sql.*"%><html>
<body>
以下是从MYSQL数据库读取的数据:<br>
<table border=1>
<tr><td>id</td><td>书名</td></tr>
<%
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
Connection con=java.sql.DriverManager.getConnection("jdbc:mysql://127.0.0.1/jspdev","root","root");
Statement stmt=con.createStatement();
ResultSet rst=stmt.executeQuery("select * from book");
while(rst.next())
{
out.println("<tr>");
out.println("<td>“+rst.getString(1)+"</td>");
out.println("<td>"+rst.getString(2)+"</td>");
out.println("</tr>")
}
rst.close();
stmt.close();
con.close();
%>
</table>
</body>
</html>
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 7 in the jsp file: /testMysql.jsp
Syntax error on token "/", delete this token
4: 以下是从MYSQL数据库读取的数据:<br>
5: <table border=1>
6: <tr><td>id</td><td>书名</td></tr>
7: <%
8: Class.forName("org.gjt.mm.mysql.Driver").newInstance();
9: Connection con=java.sql.DriverManager.getConnection("jdbc:mysql://127.0.0.1/jspdev","root","root");
10: Statement stmt=con.createStatement();
An error occurred at line: 7 in the jsp file: /testMysql.jsp
String literal is not properly closed by a double-quote
4: 以下是从MYSQL数据库读取的数据:<br>
5: <table border=1>
6: <tr><td>id</td><td>书名</td></tr>
7: <%
8: Class.forName("org.gjt.mm.mysql.Driver").newInstance();
9: Connection con=java.sql.DriverManager.getConnection("jdbc:mysql://127.0.0.1/jspdev","root","root");
10: Statement stmt=con.createStatement();
An error occurred at line: 7 in the jsp file: /testMysql.jsp
Syntax error, insert ")" to complete Expression
4: 以下是从MYSQL数据库读取的数据:<br>
5: <table border=1>
6: <tr><td>id</td><td>书名</td></tr>
7: <%
8: Class.forName("org.gjt.mm.mysql.Driver").newInstance();
9: Connection con=java.sql.DriverManager.getConnection("jdbc:mysql://127.0.0.1/jspdev","root","root");
10: Statement stmt=con.createStatement();
An error occurred at line: 16 in the jsp file: /testMysql.jsp
Syntax error, insert ";" to complete Statement
13: {
14: out.println("<tr>");
15: out.println("<td>“+rst.getString(1)+"</td>");
16: out.println("<td>"+rst.getString(2)+"</td>");
17: out.println("</tr>")
18: }
19: rst.close();