public class Resultsetmovetest {
public static void Main (string[] args) {
Todo automatically generate method stubs
try {
Write one of the most common query statements
String sql = "SELECT * FROM Login-id";
Obtain the connection provided by (3) in section 2.1; Connection con = dbutil.getconn ();
Get types that can be scrolled back and forth
Statement stmt = con.createstatement (resultset.type_scroll_insensitive, resultset.concur_updatable);
Obtaining result sets through statement
ResultSet rs = stmt.executequery (SQL);
int i = 0;
System.out.println ("= = = Start testing all records obtained ===n"); SYSTEM.OUT.PRINTLN ("Cursor down 2/n"); Rs.absolute (2); System.out.println ("Now total in the first:" + rs.getrow () + "line. "); Rs.last (); SYSTEM.OUT.PRINTLN ("There are now:" + rs.getrow () +) record. "); Rs.movetoinsertrow (); SYSTEM.OUT.PRINTLN ("Inserts a record.") "); Rs.insertrow (); SYSTEM.OUT.PRINTLN ("Inserts a record.") "); Rs.insertrow (); Rs.last (); SYSTEM.OUT.PRINTLN ("There are now:" + rs.getrow () +) record. "); Rs.deleterow (); Rs.last (); SYSTEM.OUT.PRINTLN ("There are now:" + rs.getrow () +) record. ");
Rs.deleterow ();
System.out.println ("= = = All records obtained by Test are successful ===n");
catch (Exception e) {
E.printstacktrace ();
}
}
}