喜悦国际村 
» 游客:  注册 | 登录 | 搜索 | 统计 | 喜悦证交所 | 帮助

RSS 订阅当前论坛  

[北京]代朋友公司招聘PHP高级程序员多名

上一主题 下一主题
     
标题: 问个access数据庫连接的问题  
 
grimbomb (grimbomb)
新手上路
Rank: 1
初级会员



UID 69202
精华 0
积分 1
帖子 1
金钱 1 喜悦币
威望 0
人脉 0
阅读权限 10
注册 2006-3-9
状态 离线
问个access数据庫连接的问题

JAVA程序代码
package student;
import java.sql.*;
public class conn {
        String sDBDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
        String sConnStr = "jdbcdbc:student";
        Connection connect = null;
        ResultSet rs = null;
        public conn() {
                try {
                        Class.forName(sDBDriver);
                }
                catch(java.lang.ClassNotFoundException e) {
                        System.err.println( e.getMessage());
                }
        }
        public ResultSet executeQuery(String sql) {
                try {
                        connect = DriverManager.getConnection(sConnStr);
                        Statement stmt = connect.createStatement();
                        rs = stmt.executeQuery(sql);
                }
                catch(SQLException ex) {
                        System.err.println(ex.getMessage());
                }
                return rs;
        }
}
JSP代码
<%@ page contentType="text/html;charset=GBK" %>
<%@ page language="java" import="java.sql.*"%>
<jsp:useBean id="connDbBean" scope="page"   class="student.conn"/>
<html>
<head>
        <title>test db connection</title>
</head>
<body bgcolor="#FFFFFF">
<div align="center">
  <table width="60%" border="1">
    <tr bgcolor="#CCCCFF">
      <td width="50%">
        <div align="center"><font color="#FF0033"><b>姓名</b></font></div>
      </td>
      <td width="25%">
        <div align="center"><font color="#FF0033"><b>性别</b></font></div>
      </td>
      <td width="25%">
        <div align="center"><font color="#FF0033"><b>分数</b></font></div>
      </td>
    </tr>
<%
ResultSet RS_result = connDbBean.executeQuery("select * from table1");
String studentName="";
String studentSex="";
int studentScore=0;
while(RS_result.next())
{
studentName  = RS_result.getString("name");
studentSex   = RS_result.getString("sex");
studentScore = RS_result.getInt("score");
%>
    <tr>
      <td width="50%" bgcolor="#FFFFFF">
        <div align="center"><%=studentName%></div>
      </td>
      <td width="25%">
        <div align="center"><%=studentSex%></div>
      </td>
      <td width="25%">
        <div align="center"><%=studentScore%></div>
      </td>
    </tr>
<%
}
RS_result.close();
%>
  </table>
</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: /conn_db.jsp(3,0) The value for the useBean class attribute student.conn is invalid.
        org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
        org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
        org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:150)
        org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1227)
        org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
        org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
        org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
        org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
        org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
        org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
        org.apache.jasper.compiler.Generator.generate(Generator.java:3272)
        org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:244)
        org.apache.jasper.compiler.Compiler.compile(Compiler.java:495)
        org.apache.jasper.compiler.Compiler.compile(Compiler.java:476)
        org.apache.jasper.compiler.Compiler.compile(Compiler.java:464)
        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.30 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.0.30
能告诉我是什么原因么。。
2006-3-9 01:19 PM#1
查看资料  发短消息  顶部
     


  可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题 | 开通个人空间  


 




Powered by Discuz! 6.1.0  © 2001-2010 Comsenz Inc.
Processed in 0.025604 second(s), 6 queries

(冀ICP备05009913号) 管理员:sadly 邮箱/MSN: sadly@phpx.com QQ:824008(长隐) 清除 Cookies - - Archiver - WAP