标题:mysql与tomcat连接中遇到的问题
只看楼主
lulu820830
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2008-3-24
 问题点数:0 回复次数:2 
mysql与tomcat连接中遇到的问题
我刚开始学JSP,从别人那里弄来个源程序,服务器用的是tomcat6.16,数据库用的是mysql5.0,开始不知道怎样连接,后来从网上查了些资料,用JDBC5.08连接,但是弄了几天就是打不开,浏览器上显示如下,麻烦高手指点一下
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: An exception occurred processing JSP page /corrision/conn/conn.jsp at line 14

11: String dbUrl="jdbc:mysql://localhost:3306/OA?useUnicode=true&characterEncoding=GBK";
12: String dbUser="root";
13: String dbPwd="123456";
14: con=java.sql.DriverManager.getConnection(dbUrl,dbUser,dbPwd);
15: stmt=con.createStatement();
16: %>


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root cause

javax.servlet.ServletException: com.mysql. Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **
搜索更多相关主题的帖子: mysql tomcat jsp HTTP Status 500 - 
2008-08-20 15:01
justholdon
Rank: 1
等 级:新手上路
威 望:2
帖 子:69
专家分:0
注 册:2007-4-23
得分:0 
下载驱动,然后
Connection con;
 Statement sql;
 ResultSet rs;
 
 Class.forName("org.gjt.mm.mysql.Driver").newInstance();

con=DriverManager.getConnection("jdbc:mysql://localhost/dbname","username","password");
     sql=con.createStatement();
     rs=sql.executeQuery(" select count(*) from tablename");

just hold on !
2008-09-14 23:57
elan1986
Rank: 6Rank: 6
等 级:贵宾
威 望:18
帖 子:458
专家分:407
注 册:2007-12-17
得分:0 
500是服务器错误!

上传源码看看!
我也正在学习JSP
刚刚测试成功--JSP和ACCESS连接
2008-09-23 11:27



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-229172-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014323 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved