// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.sql.*;

public class FwdBck {
   public static void main(String[] args) {
      try {
         // JDBC ODBC bridge and Access does not work replace with other driver & database
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         Connection con = DriverManager.getConnection("jdbc:odbc:TestMSAccess", "", "");
         Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
         ResultSet rs = stmt.executeQuery("SELECT * FROM T1");
         rs.last();
         int n = rs.getRow();
         rs.first();
         System.out.println(n);
         for(int i = 0; i < n; i++) {
             System.out.println(rs.getInt("F1"));
             rs.next();
         }
      } catch (ClassNotFoundException e) {
            e.printStackTrace();
      } catch (SQLException e) {
            e.printStackTrace();
      }
   }
}
