Querying a Database

Querying a Database: Querying a Database: an overview, JDBC Objects, Full Example.

Updated

  1. Querying a Database: an overview (Journeyman): Reading data from a database in Java takes three steps: connect to the database, run an SQL query, and read the results.
  2. JDBC Objects (Journeyman): Meet the three objects that query MySQL from Java: a BasicDataSource to connect, a JdbcTemplate to run SQL, and a SqlRowSet to read the rows that come back.
  3. Full Example (Journeyman): A complete main method that connects to the northwind database, selects every product, and prints each product's id, name and price.