... using JdbcRowSet.


  1   // Fig. 24.30: JdbcRowSetTest.java
  2   // Displaying the contents of the Authors table using JdbcRowSet.
  3   import java.sql.ResultSetMetaData;
  4   import java.sql.SQLException;
  5   import javax.sql.rowset.JdbcRowSet;    
  6   import javax.sql.rowset.RowSetProvider;
  7
  8   public class JdbcRowSetTest {
  9      // JDBC driver name and database URL
 10      private static final String DATABASE_URL = "jdbc:derby:books";
 11      private static final String USERNAME = "deitel";
 12      private static final String PASSWORD = "deitel";
 13
 14      public static void main(String args[]) {
 15         // connect to database books and query database
 16         try (JdbcRowSet rowSet =                          
 17            RowSetProvider.newFactory().createJdbcRowSet()) {
 18
 19            // specify JdbcRowSet properties                        
 20            rowSet.setUrl( ...

Get Java How To Program, Late Objects, 11th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.