| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 908 人关注过本帖
标题:[求助]关于连接mysql的问题
取消只看楼主 加入收藏
unbelievable
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-9-22
收藏
 问题点数:0 回复次数:2 
[求助]关于连接mysql的问题

怎么总是无法连接mySQL啊??

代码如下:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>mysql连接数据库</title>
</head>

<body>


<%
Connection con = null;
Statement st = null;
ResultSet rs = null;
String dbuser="root";
String dbpswd="12345";
try {
try{Class.forName("com.mysql.jdbc.Driver").newInstance();}
catch (Exception e) {
out.println("Error1 :"+e.toString());
}
String url ="jdbc:mysql://localhost:3306/jnestore";
Connection conn= DriverManager.getConnection(url,dbuser,dbpswd);
st=conn.createStatement();
String sql="select * from catalog_items";
rs=st.executeQuery(sql);

while(rs.next())
{out.print("ok");}
}catch (Exception e) {
out.println("Error :"+e.toString());
}
finally {
try {
rs.close();
st.close();
con.close();
} catch (Exception ex) {
out.println("Error closing database");
} }%>

</body>
</html>

错误信息为:
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 /rcyjc/mysql.jsp at line 19

16: String dbuser="root";
17: String dbpswd="12345";
18: try {
19: try{Class.forName("com.mysql.jdbc.Driver").newInstance();}
20: catch (Exception e) {
21: out.println("Error1 :"+e.toString());
22: }


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:524)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:417)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root cause

javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/aspectj/lang/Signature
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:850)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
org.apache.jsp.rcyjc.mysql_jsp._jspService(mysql_jsp.java:104)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root cause

java.lang.NoClassDefFoundError: org/aspectj/lang/Signature
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Unknown Source)
org.apache.jsp.rcyjc.mysql_jsp._jspService(mysql_jsp.java:72)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.13 logs.

搜索更多相关主题的帖子: mysql 数据库 dtd java 
2007-09-23 12:40
unbelievable
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-9-22
收藏
得分:0 
MySQL的驱动配置是什么东东??怎么配置???
2007-09-23 21:19
unbelievable
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-9-22
收藏
得分:0 
莫非就是所谓的mysql-connector-java-5.0.5-bin.jar????
2007-09-23 21:20
快速回复:[求助]关于连接mysql的问题
数据加载中...
 
   



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

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