LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 716|回复: 3

一个关于TOMCAT5。0。29连接MYSQL问题,我已经配置过JDBC了,其它的帖子我不太明白

[复制链接]
发表于 2004-11-27 17:17:59 | 显示全部楼层 |阅读模式
这是怎么回事呀,我对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>
发表于 2004-11-27 22:08:22 | 显示全部楼层
好像括号都是中文括符。。。
发表于 2004-11-27 22:09:45 | 显示全部楼层
分号也是中文的
发表于 2004-12-3 12:22:06 | 显示全部楼层
mysql-connector-java装了吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表