<%@page contentType="text/html;charset=gb2312"%> <%@page import="java.sql.*"%> <html> <body> <% try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(ClassNotFoundException e){ out.print(e); } try{ String strDirPath=application.getRealPath(request.getRequestURI()); strDirPath=strDirPath.substring(0,strDirPath.lastIndexOf('\\'))+"\\"; String url = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ="+strDirPath+"jcc.mdb"; Connection conn = DriverManager.getConnection(url); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("Select * FROM user"); out.println("User-list"+"<br>"); while(rs.next()){ out.print(rs.getString(1)+" "); out.print(rs.getString(2)+"<br>"); } rs.close(); stmt.close(); conn.close(); } catch(Exception ex){ out.print(ex); } %> </body> </html>