Public class ResultSetMoveTest {
Public static void main (String [] args ){
// TODO automatically generates method stubs
Try {
// Write the most common query statement
String SQL = "select * from login order by id ";
// Obtain the Connection provided by (3) in section 2.1; Connection con = DBUtil. getConn ();
// Obtain the scroll type.
Statement stmt = con. createStatement (ResultSet. TYPE_SCROLL_INSENSITIVE, ResultSet. CONCUR_UPDATABLE );
// Obtain the result set through Statement
ResultSet rs = stmt.exe cuteQuery (SQL );
Int I = 0;
System. out. println ("=== start testing all records obtained ==="); System. out. println ("move two cursor down/n"); rs. absolute (2); System. out. println ("now in total:" + rs. getRow () + "Row. "); Rs. last (); System. out. println (" Total: "+ rs. getRow () +" records. "); Rs. moveToInsertRow (); System. out. println (" insert a record. "); Rs. insertRow (); System. out. println (" insert a record. "); Rs. insertRow (); rs. last (); System. out. println (" Total: "+ rs. getRow () +" records. "); Rs. deleteRow (); rs. last (); System. out. println (" Total: "+ rs. getRow () +" records. ");
// Rs. deleteRow ();
System. out. println ("=== all records obtained by the test succeed === ");
} Catch (Exception e ){
E. printStackTrace ();
}
}
}