28.8 Manipulating Databases with JDBC
This section presents two examples. The first introduces how to connect to a database and query it. The second demonstrates how to display the result of the query in a
28.8.1 Connecting to and Querying a Database
The example of Fig. 28.23 performs a simple query on the
books database that retrieves the entire
Authors table and displays the data. The program illustrates connecting to the database, querying the database and processing the result. The discussion that follows presents the key JDBC aspects of the program. [Note: Sections 28.5–28.7 demonstrate how to start the MySQL server, configure a user account and create the
books database. These steps must be performed before executing the program ...