下在一个jdk应该就可以了,详细请参考相关资料

解决方案 »

  1.   

    //there are a few steps you have to do before you can run and test 
    //the following code, hope it will give a basic idea
    //the code below will use JDBC to connect to your data source 
    //read ALL the data inside and print out in you console window
    //IF YOU CAN GET THIS JOB DONE I THINK YOU WILL ABTAIN A LOT!!
    //step1
    //use microsoft Access to create a table named BOOKS.//step2
    //establish a data source naemed "BooksInfoODBC"(quote not include)
    //if you don't how to create a data source in you computer, 
    //check with your frieds//step 3
    //create a java class and run the following codeimport java.io.*;
    import java.sql.*;public class Test1 {
      public static void main(String[] args) {
        try {
          // loads the jdbc odbc bridge driver
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        }
        catch (ClassNotFoundException e) {
          System.err.println("Error" + e) ;
        }
        try {
          // establish db connection through a Connection object
          Connection con =  DriverManager.getConnection("jdbc:odbc:BooksInfoODBC") ;      // instance of a sql statement
          Statement stmt = con.createStatement();      // prepare sql statement
          String sqlStr = "SELECT * FROM BOOKS";      // execute the SELECT query through executeQuery()
          // save the result in ResultSet
          ResultSet rs = stmt.executeQuery(sqlStr);      // process the result of the ResultSet
          System.out.println(" the records selected are");
          ResultSetMetaData info = rs.getMetaData();      while (rs.next()) {
            for (int i=1; i<=info.getColumnCount(); i++) {
              System.out.print("\t" + rs.getString(i));
            }
            System.out.println();
          }      // close the ResultSet, Statement and Connection objects
          rs.close();
          stmt.close();
          con.close();
        }
        catch (SQLException e) {
          System.err.println("Error " + e);
        }
      }
    }