Table of Contents
Getting Set Up
Basic JDBC Syntax

JDBC is the Java DataBase Connection. It is a simple, generic, and portable way of interacting with different types of databases. It is essentially a set of interfaces, defined by Sun, that cover all the interactions you could have with a standard SQL database. The vendor (in this case, PostgreSQL) supplies concrete implementations that implement these interfaces. Those concrete implementations handle the vendor-specific interactions with the database: connecting, logging in, stored procedures, and so forth.

This interface is designed this way so that a program using JDBC can connect to any JDBC-compliant database, without rewriting the code. However, there are some caveats. One is that JDBC does not do any client-side SQL parsing or syntax checking. The SQL is passed off transpareantly to the database, whether or not it is a valid SQL statement. Therefore, if the SQL being written is valid on one vendor's database, but invalid on another vendor's database, the implementor won't know until the actual connection is made and the SQL is sent across. Sun is attempting to deal with this problem, and there may be some provisions made to correct this, either in later versions of JDBC or in a different standard.

Another issue is that each vendor has additional helper classes specific to that vendor. For instance, PostgreSQL has extensions for geometric data types. Other vendors won't support this extension; it is specific to PostgreSQL. Therefore, your program will not work with another JDBC database, despite using the JDBC "standard".

One advantage of the PostgreSQL JDBC driver is that it is a "Type 4" Driver. This means that it is written in Pure Java, so it can be taken anywhere and used anywhere, as long as the platform it is used on has IP capabilities, because the driver only connects via IP.