跪求帮助
我已经建立了用access建立了图书管理系统的数据库,并建立了图书明细表.也弄了数据源.执行别的jsp的文件都成功,但唯独连接数据库的都没用。请各位帮帮我
<%@ page contentType= "text/html; charset=gb2312 " language= "java " import= "java.sql.* "
errorPage= " " %>
<html>
<head>
<title> JSP连接Access数据库(一)显示记录 </title>
</head>
<body>
<div align= "center " > JSP连接Access数据库 </div>
<div align= "center " >
<br> <hr>
<p>
<%
//载入驱动程序类别
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver ");
//建立数据库连接,jspdata为ODBC数据源名称
Connection con = DriverManager.getConnection( "jdbc:odbc:jspdata ");
//建立Statement对象
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
//建立ResultSet(结果集)对象,并执行SQL语句
ResultSet rs = stmt.executeQuery( "select * from 图书明细表 ");
%>
</p>
<p align= "center "> 图书管理系统图书明细表中记录如下 </p>
<table width= "640 " border= "1 " align= "center " bordercolor= "#7188e0 ">
<tr bgcolor= "d1d1ff ">
<Td width= "80 "> 图书编号 </th>
<th width= "300 "> 图书名称 </th>
<th width= "200 "> 出版社 </th>
<th width= "200 "> 定价 </th>
<th width= "200 "> 日期 </th>
</tr> <%
while(rs.next())
{ %>
<tr bgcolor= "#f8f8f8 ">
<td> <%= rs.getString(1) %> </td>
<td> <%= rs.getString(2) %> </td>
<td> <%= rs.getString(3) %> </td>
<td bgcolor= "#f6f6f8 "> <%= rs.getString(4) %> </td>
<td> <%= rs.getString(5) %> </td>
</tr>
<%
}
rs.close();
stmt.close();
con.close();
%>
</table>
<p align= "center "> <br>
如果能看到表格中的数据,说明连接数据库成功! </p>
</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: Exception in JSP: /jspdata.jsp:15
12: //载入驱动程序类别