The JDBC package is a large piece of technology. This chapter described the basic techniques for connecting a Java application to PostgreSQL using JDBC and the PostgreSQL JDBC driver. It does not cover a few of the more advanced JDBC topics.
The Connection class includes methods that can commit and roll back transactionsof course, you can do that yourself by executing COMMIT and ROLLBACK commands.
The examples in this chapter intercept database errors by catching exceptions. JDBC also throws exceptions for database warnings.
One of the more interesting features added to the JDBC 2.0 specification is the updateable ResultSet. This feature lets you update, insert, and delete rows in a result set by directly modifying the ResultSet, rather than executing the corresponding commands yourself.
Finally, JDBC gives you a way to map PostgreSQL data types into Java data types. In this chapter, you used String values (and an occasional Boolean) to communicate between Java and PostgreSQL, but JDBC can map between other data types as well. You can even map user-defined PostgreSQL types into Java.
JDBC is a powerful and well-designed technology. If you are interested in Java programming, you will want to learn more about JDBC. Sun has done a great job of documenting the JDBC package. For more information, I suggest reading the "JDBC Technology Guide: Getting Started" at http://java.sun.com/j2se/1.3/_docs/guide/jdbc/.
Part I: General PostgreSQL Use
Introduction to PostgreSQL and SQL
Working with Data in PostgreSQL
PostgreSQL SQL Syntax and Use
Part II: Programming with PostgreSQL
Introduction to PostgreSQL Programming
The PostgreSQL C APIlibpq
A Simpler C APIlibpgeasy
The New PostgreSQL C++ APIlibpqxx
Embedding SQL Commands in C Programsecpg
Using PostgreSQL from an ODBC Client Application
Using PostgreSQL from a Java Client Application
Using PostgreSQL with Perl
Using PostgreSQL with PHP
Using PostgreSQL with Tcl and Tcl/Tk
Using PostgreSQL with Python
Npgsql: The .NET Data Provider
Other Useful Programming Tools
Part III: PostgreSQL Administration
Introduction to PostgreSQL Administration
Internationalization and Localization
Replicating PostgreSQL Data with Slony