Java Reference
In-Depth Information
}
}
}
}
public static void queryBookAuthor() {
RowSetFactory factory;
try {
// Create a new RowSetFactory
factory = RowSetProvider.newFactory();
// Create a CachedRowSet object using the
factory
bookAuthors = 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
bookAuthors.setCommand("SELECT ID, LASTNAME,
FIRSTNAME FROM BOOK_AUTHOR");
bookAuthors.execute(conn);
// You can now work with the object contents
in a disconnected state
while (bookAuthors.next()) {
System.out.println(bookAuthors.getString(1)
+ ": " + bookAuthors.getString(2)
+ ", "
+ bookAuthors.getString(3));
}
Search WWH ::




Custom Search