请教一个问题!关于JSP连接ACCESS的问题!
这是我写的JSP与ACCESS连接的代码和数据库!但是在连接的时候 一直不能成功 请问是什么原因
谢谢
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>ACCESS连接测试</title>
</head>
<body>
<%
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e){
out.print(e);
}
try{
String url = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=E:/test.mdb";
Connection conn = DriverManager.getConnection(url);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM stu");
out.println("Table-list"+"<br>");
while(rs.next()){
out.print(rs.getInt(1)+" ");
out.print(rs.getString(2)+"<br>");
}
rs.close();
stmt.close();
conn.close();
}
catch(Exception ex){
out.print(ex);
}
%>
</body>
</html>
test.rar
(8.52 KB)