|
这是怎么回事呀,我对JDBC可能错了,我对其它的一些帖子看得不明白,请问该如何解决呢?
我的源文件如下:
<html>
<head>
<title>Test JDBC For MySQL</title>
</head>
<body>
<%@ page contentType="text/html;charset=gb2312" %>
<%
Class.forName("com.mysql.jdbc.Driver").newInstance();
java.sql.Connection conn;
conn = java.sql.DriverManager.getConnection("jdbc:mysql://localhost/test_db?user=root&password=xshi");
%>
</body>
</html>
在测试连接时出现了这样的错误:
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 7 in the jsp file: /jsp.jsp
Generated servlet error:
F:\tomcat\work\Catalina\localhost\jsp-examples\org\apache\jsp\jsp_jsp.java:50: illegal character: \12288
銆?銆? Class.forName锛?"com.mysql.jdbc.Driver"锛?.newInstance锛堬級锛?
^
An error occurred at line: 7 in the jsp file: /jsp.jsp
Generated servlet error:
F:\tomcat\work\Catalina\localhost\jsp-examples\org\apache\jsp\jsp_jsp.java:50: illegal character: \12288
銆?銆? Class.forName锛?"com.mysql.jdbc.Driver"锛?.newInstance锛堬級锛?
^
An error occurred at line: 7 in the jsp file: /jsp.jsp
Generated servlet error:
F:\tomcat\work\Catalina\localhost\jsp-examples\org\apache\jsp\jsp_jsp.java:50: illegal character: \65288
銆?銆? Class.forName锛?"com.mysql.jdbc.Driver"锛?.newInstance锛堬級锛?
^
An error occurred at line: 7 in the jsp file: /jsp.jsp
Generated servlet error:
F:\tomcat\work\Catalina\localhost\jsp-examples\org\apache\jsp\jsp_jsp.java:50: illegal character: \65289
銆?銆? Class.forName锛?"com.mysql.jdbc.Driver"锛?.newInstance锛堬級锛?
^
An error occurred at line: 7 in the jsp file: /jsp.jsp
Generated servlet error:
F:\tomcat\work\Catalina\localhost\jsp-examples\org\apache\jsp\jsp_jsp.java:50: illegal character: \65288
銆?銆? Class.forName锛?"com.mysql.jdbc.Driver"锛?.newInstance锛堬級锛?
^
An error occurred at line: 7 in the jsp file: /jsp.jsp
Generated servlet error:
F:\tomcat\work\Catalina\localhost\jsp-examples\org\apache\jsp\jsp_jsp.java:50: illegal character: \65289
銆?銆? Class.forName锛?"com.mysql.jdbc.Driver"锛?.newInstance锛堬級锛?
^
An error occurred at line: 7 in the jsp file: /jsp.jsp
Generated servlet error:
F:\tomcat\work\Catalina\localhost\jsp-examples\org\apache\jsp\jsp_jsp.java:50: illegal character: \65307
銆?銆? Class.forName锛?"com.mysql.jdbc.Driver"锛?.newInstance锛堬級锛?
^
An error occurred at line: 7 in the jsp file: /jsp.jsp
Generated servlet error:
F:\tomcat\work\Catalina\localhost\jsp-examples\org\apache\jsp\jsp_jsp.java:51: illegal character: \12288
銆?銆? java.sql.Connection conn锛?
^
An error occurred at line: 7 in the jsp file: /jsp.jsp
Generated servlet error:
F:\tomcat\work\Catalina\localhost\jsp-examples\org\apache\jsp\jsp_jsp.java:51: illegal character: \12288
銆?銆? java.sql.Connection conn锛?
^
An error occurred at line: 7 in the jsp file: /jsp.jsp
Generated servlet error:
F:\tomcat\work\Catalina\localhost\jsp-examples\org\apache\jsp\jsp_jsp.java:51: illegal character: \65307
銆?銆? java.sql.Connection conn锛?
^
An error occurred at line: 7 in the jsp file: /jsp.jsp
Generated servlet error:
F:\tomcat\work\Catalina\localhost\jsp-examples\org\apache\jsp\jsp_jsp.java:52: illegal character: \12288
An error occurred at line: 7 in the jsp file: /jsp.jsp
Generated servlet error:
銆?銆? conn = java.sql.DriverManager.getConnection锛?"jdbc:mysql://localhost/test_db?user=root&password=xshi"锛夛紱
^
An error occurred at line: 7 in the jsp file: /jsp.jsp
Generated servlet error:
F:\tomcat\work\Catalina\localhost\jsp-examples\org\apache\jsp\jsp_jsp.java:52: illegal character: \12288
An error occurred at line: 7 in the jsp file: /jsp.jsp
Generated servlet error:
銆?銆? conn = java.sql.DriverManager.getConnection锛?"jdbc:mysql://localhost/test_db?user=root&password=xshi"锛夛紱
^
An error occurred at line: 7 in the jsp file: /jsp.jsp
Generated servlet error:
F:\tomcat\work\Catalina\localhost\jsp-examples\org\apache\jsp\jsp_jsp.java:52: illegal character: \65288
An error occurred at line: 7 in the jsp file: /jsp.jsp
Generated servlet error:
銆?銆? conn = java.sql.DriverManager.getConnection锛?"jdbc:mysql://localhost/test_db?user=root&password=xshi"锛夛紱
^
An error occurred at line: 7 in the jsp file: /jsp.jsp
Generated servlet error:
F:\tomcat\work\Catalina\localhost\jsp-examples\org\apache\jsp\jsp_jsp.java:52: illegal character: \65289
An error occurred at line: 7 in the jsp file: /jsp.jsp
Generated servlet error:
銆?銆? conn = java.sql.DriverManager.getConnection锛?"jdbc:mysql://localhost/test_db?user=root&password=xshi"锛夛紱
^
An error occurred at line: 7 in the jsp file: /jsp.jsp
Generated servlet error:
F:\tomcat\work\Catalina\localhost\jsp-examples\org\apache\jsp\jsp_jsp.java:52: illegal character: \65307
An error occurred at line: 7 in the jsp file: /jsp.jsp
Generated servlet error:
銆?銆? conn = java.sql.DriverManager.getConnection锛?"jdbc:mysql://localhost/test_db?user=root&password=xshi"锛夛紱
^
An error occurred at line: 7 in the jsp file: /jsp.jsp
Generated servlet error:
F:\tomcat\work\Catalina\localhost\jsp-examples\org\apache\jsp\jsp_jsp.java:53: illegal character: \12288
銆?銆?
^
An error occurred at line: 7 in the jsp file: /jsp.jsp
Generated servlet error:
F:\tomcat\work\Catalina\localhost\jsp-examples\org\apache\jsp\jsp_jsp.java:53: illegal character: \12288
銆?銆?
^
17 errors
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:432)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:492)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:471)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:459)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.29 logs.
--------------------------------------------------------------------------------
Apache Tomcat/5.0.29<html> |
|