Databases and JDBC

Study for Week 5

This week we will be looking at how to connect to databases using JDBC.

This is our first week of persistence layer technologies. We will start with a quick look at how to use JDBC to connect to a database, then investigate some of the performance, security and maintainability issues.

At the end of this session, students should be able to:

  • Understand the purpose of JDBC
  • Use JDBC to connect to a database
  • Prevent SQL injection attacks
  • Explain how connection pooling improves performance
  • Use the data access object design pattern

Why databases?

Why should we use databases when developing applications, and what is the JavaDB database?


JDBC is the fundamental technology for accessing a database using Java:

JDBC details

A more detailed look at features of JDBC:

JDBC performance

Types of JDBC drivers and how to use connection pooling to improve performance:

Design patterns for data access code

If you would like to study further, you may like to refer to this tutorial:

You can also refer to Chapters 3 and 4 of Database Programming with JDBC & Java:

Basic working knowledge of SQL will be assumed. If you would like to practice your SQL, this site has interactive tutorials: