JDBC  «Prev  Next »

Lesson 3 How to use JDBC
Objective Describe how to use JDBC.

JDBC Servlets and Databases

To use JDBC, you follow a number of fairly simple steps:
  1. First you create a database, using any of the many databases supported by ODBC.
    You can also use a non-ODBC database if the database vendor provides a JDBC driver, but most vendors provide ODBC drivers.
  2. You must ensure that the appropriate driver is installed on your computer.
    It is installed at the same time as the database program.
  3. Once the data source and drivers are in place, you can write JDBC code.
    The first thing JDBC code does is to make a database connection.
    With the connection in place, you build SQL statements. These statements are commands to the database, and work with the data you get back from the data source however you wish. In most cases, you will include it in the HTML your servlet is generating.

The last step will be explained in detail in the lessons that follow.
The next lesson is an introduction to the basic SQL commands you will be using in this module.