Looking at the work required to use a database from Java, we see that there are basically three tasks we need to accomplish. We have to:
- Connect to the database so we can send it our requests
- Compose and send those requests to the database
- Catch the results of our requests and do something with them
This module will focus on the first task. We will look at the fundamentals of our program's connection to a relational database.
Your learning will be in the context of the case study you have been following in this course.
Since the Brazil Hospital Project has decided to use Java and JDBC for accessing the data they will store in a database system, you must become familiar with the steps needed to use JDBC.
As you consider the work involved, you realize that there are three basic steps to working with the database.
- First, you have to connect to it.
- Second, you have to compose a request or command and send it to the database.
- Finally, you have to catch and report the results returned from the database.
To begin, you must learn how to accomplish that first step.
After completing this module, you will have the skills and knowledge to:
- Describe the different pieces of the JDBC specification
- Write JDBC URLs
- Define the three functions that JDBC drivers perform in the data request process
- Define the purpose of four basic JDBC drivers
- Use the JDBC DriverManager to connect to the DBMS
- Write a simple yet complete JDBC program
In the next lesson, you will learn about the JDBC's relationship to SQL as a database connectivity tool.