Java Reference
In-Depth Information
factory = RowSetProvider.newFactory();
// Create a CachedRowSet object using the
factory
crs = factory.createCachedRowSet();
// Alternatively populate the CachedRowSet
connection settings
// crs.setUsername(createConn.getUsername());
// crs.setPassword(createConn.getPassword());
// crs.setUrl(createConn.getJdbcUrl());
// Populate a query that will obtain the data
that will be used
crs.setCommand("select id, recipe_number,
recipe_name, description from recipes");
// Set key columns
int[] keys = {1};
crs.setKeyColumns(keys);
crs.execute(conn);
// You can now work with the object contents
in a disconnected state
while (crs.next()) {
System.out.println(crs.getString(2) + ":
" + crs.getString(3)
+ " - " + crs.getString(4));
}
} catch (SQLException ex) {
ex.printStackTrace();
}
}
public static boolean updateData() {
boolean returnValue = false;
try {
// Move to the position before the first row
Search WWH ::




Custom Search