Chapter 24. Talking to Databases
In the next two chapters, you're going to look at how Java programs can interface with relational databases or any database that can be accessed using Structured Query Language (SQL). You'll be executing SQL statements by using classes that come with the Java Development Kit (JDK).
First I'll introduce the basic ideas behind databases and how they store data. This leads naturally into a discussion of SQL, the language that is used with many relational databases to both define and query data and which is a prerequisite for database access in Java. Then you'll look into the Java Database Connectivity (JDBC) class library, which provides a standard way for establishing and maintaining a Java program's connection to a database. Once you have a connection to a database, you can use SQL to access and process the contents.
In this first chapter, you'll take a brief tour of database concepts, SQL and JDBC. In the next chapter you'll go into more depth on the capabilities provided by JDBC and develop a database browsing application. In this chapter you will learn:
What databases are
What the basic SQL statements are and how you apply them
What the rationale behind JDBC is
How to write a simple JDBC program
What the key elements of the JDBC API are
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access