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 transactions?of 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. As of PostgreSQL release 7.2.1, updateable result sets are not fully implemented.

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

    Part II: Programming with PostgreSQL