Precompiled versions of the driver can be downloaded from
JDBC web site.
Alternatively you can build the driver from source, but you
should only need to do this if you are making changes to the
source code. For details, refer to the PostgreSQL installation
instructions. After installation, the driver should be found in
The resulting driver will be built for the version of Java you are
running. If you build with a 1.1 JDK you will build a version
that supports the JDBC 1 specification, if you build with a Java 2
JDK (e.g., JDK 1.2 or JDK 1.3) you will build a version that
supports the JDBC 2 specification.
To use the driver, the JAR archive (named
postgresql.jar if you built from source, otherwise
it will likely be named jdbc7.2-1.1.jar or
jdbc7.2-1.2.jar for the JDBC 1 and JDBC 2 versions
needs to be included in the
class path, either by putting it in the CLASSPATH
environment variable, or by using flags on the
java command line.
For instance, I have an application that uses the
JDBC driver to access a large database
containing astronomical objects. I have the application and the
JDBC driver installed in the /usr/local/lib directory, and the
Java JDK installed in
/usr/local/jdk1.3.1. To run the
application, I would use:
- finder.jar contains the Finder application.
Loading the driver from within the application is covered in
Because Java only uses TCP/IP connections, the
PostgreSQL server must be configured to
accept TCP/IP connections. This can be done by setting
tcpip_socket = true in the
postgresql.conf file or by supplying the
-i option flag when starting
Also, the client authentication setup in the
pg_hba.conf file may need to be configured.
Refer to the Administrator's Guide for
details. The JDBC Driver supports the trust,
ident, password, md5, and crypt authentication methods.