Java 教程是为 JDK 8 编写的。本页中描述的示例和实践未利用在后续版本中引入的改进。
In this lesson you will learn the basics of the JDBC API.
入门sets up a basic database development environment and shows you how to compile and run the JDBC tutorial samples.
使用 JDBC 处理 SQL 语句outlines the steps required to process any SQL statement. The pages that follow describe these steps in more detail:
建立连接connects you to your database.
连接 DataSource 对象shows you how to connect to your database with DataSource
objects, the preferred way of getting a connection to a data source.
处理 SQLExceptionsshows you how to handle exceptions caused by database errors.
设置表describes all the database tables used in the JDBC tutorial samples and how to create and populate tables with JDBC API and SQL scripts.
从结果集中获取和修改值develop the process of configuring your database, sending queries, and retrieving data from your database.
使用准备好的语句describes a more flexible way to create database queries.
使用事务shows you how to control when a database query is actually executed.
使用 RowSet 对象introduces you to RowSet
objects; these are objects that hold tabular data in a way that make it more flexible and easier to use than result sets. The pages that follow describe the different kinds of RowSet
objects available:
使用高级数据类型introduces you to other data types; the pages that follow describe these data types in further detail:
使用存储过程shows you how to create and use a stored procedure, which is a group of SQL statements that can be called like a Java method with variable input and output parameters.
将 JDBC 与 GUI API 结合使用demonstrates how to integrate JDBC with the Swing API.