Querying a Database: an overview
Reading data from a database in Java takes three steps: connect to the database, run an SQL query, and read the results.
Journeyman · Java · SQL · Updated
The dependencies we added in Configure the Project give us the objects we need to connect to a database and run a query.
Working with data from a database requires three steps.
- Establishing a connection to the database
- Executing an SQL query
- Reading the results of the query
Let's take a closer look at these steps and the objects required to perform them.