1.建立数据库.
2.配置数据源.
3.写正确JSP代码.

解决方案 »

  1.   

    有三种办法 
    第一种是用access的JDBC驱动程序,到http://industry.java.sun.com/products/jdbc/drivers这个网站上查找并下在access的jdbc驱动程序。 
    第二个办法是你用下面的代码试试 
    con = DriverManager.getConnection("jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};DBQ=C:/data/Access/test1.mdb","dba","sql"); 
    后面的代码一样。这样你就可以访问access数据库了。 
    第三个是用sun的jdbcodbc桥,这个大家用的多了,在此就不写了
      

  2.   

    //这个例子,是从SUN的站点上找来的。当时也找了好久啊。呵呵!
    // accepts sql statments thru command line 
    import java.sql.*; 
    import java.util.*; 
    public class test { 
    public static void main(String args[]){ try 
    { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 
    Properties prop = new Properties(); 
    prop.put("user", ""); 
    prop.put("password",""); 
    prop.put("charSet","gb2312"); Connection conn=DriverManager.getConnection("jdbc:odbc:chinese",prop); //chinese 数据源
    Statement stmt=conn.createStatement(); 
    stmt.execute(args[0]); } catch(ClassNotFoundException e) 

    // JOptionPane.showMessageDialog(null,"Unable To Load The Driver Class","Login Message", JOptionPane.ERROR_MESSAGE); } 
    catch(SQLException e) 

    e.printStackTrace(); 
    System.out.println(e.getErrorCode()); 
    } }