Java Reference
In-Depth Information
} catch (SQLException ex) {
ex.printStackTrace();
}
}
public static void queryAuthorWork() {
RowSetFactory factory;
try {
// Create a new RowSetFactory
factory = RowSetProvider.newFactory();
// Create a CachedRowSet object using the
factory
authorWork = 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
authorWork.setCommand("SELECT AW.ID,
AUTHOR_ID, B.TITLE FROM AUTHOR_WORK AW, " +
"BOOK B " +
"WHERE B.ID = AW.BOOK_ID");
authorWork.execute(conn);
// You can now work with the object contents
in a disconnected state
while (authorWork.next()) {
System.out.println(authorWork.getString(1)
+ ": " + authorWork.getString(2)
+ " - "
Search WWH ::




Custom Search