Java Reference
In-Depth Information
174
JOptionPane.showMessageDialog(
null
, sqlException.getMessage(),
175
"Database error"
,
JOptionPane.ERROR_MESSAGE
);
176
177
System.exit(
1
);
// terminate application
178
}
179
}
180
}
// end class DisplayQueryResults
tableModel.disconnectFromDatabase();
a) Displaying all authors from
the
Authors
table
b) Displaying the the authors'
first and last names joined with
the titles and edition numbers
of the topics they've authored
c) Filtering the results of the
previous query to show only the
books with Java in the title
Fig. 24.28
|
Display the contents of the
Authors
table in the
books
database. (Part 5 of 5.)
Lines 27-29 and 32 declare the URL, username, password and default query that are
passed to the
ResultSetTableModel
constructor to make the initial connection to the
database and perform the default query. The
main
method (lines 36-179) creates a