List of usage examples for javax.sql.rowset.spi SyncFactory registerProvider
public static synchronized void registerProvider(String providerID) throws SyncFactoryException
From source file:Main.java
public Main() { try {//from w w w .j av a 2 s . c om SyncFactory.registerProvider("MySyncProvider"); Hashtable env = new Hashtable(); env.put(SyncFactory.ROWSET_SYNC_PROVIDER, "MySyncProvider"); crs = new CachedRowSetImpl(env); crs.execute(); // load data from custom RowSetReader System.out.println("Fetching from RowSet..."); while (crs.next()) { displayData(); } if (crs.isAfterLast() == true) { System.out.println("We have reached the end"); System.out.println("crs row: " + crs.getRow()); } System.out.println("And now backwards..."); while (crs.previous()) { displayData(); } // end while previous if (crs.isBeforeFirst()) { System.out.println("We have reached the start"); } crs.first(); if (crs.isFirst()) { System.out.println("We have moved to first"); } System.out.println("crs row: " + crs.getRow()); if (!crs.isBeforeFirst()) { System.out.println("We aren't before the first row."); } crs.last(); if (crs.isLast()) { System.out.println("...and now we have moved to the last"); } System.out.println("crs row: " + crs.getRow()); if (!crs.isAfterLast()) { System.out.println("we aren't after the last."); } } catch (SQLException e) { e.printStackTrace(); System.err.println("SQLException: " + e.getMessage()); } }