Chapter 2. Setting up the JDBC Driver

Table of Contents

This section describes the steps you need to take before you can write or run programs that use the JDBC interface.

Getting the Driver

Precompiled versions of the driver can be downloaded from the PostgreSQLâ„¢ 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. To build the JDBC driver, you need Ant 1.5 or higher and a JDK. Ant is a special tool for building Java-based packages. It can be downloaded from the Ant web site.

If you have several Java compilers installed, it depends on the Ant configuration which one gets used. Precompiled Ant distributions are typically set up to read a file .antrc in the current user's home directory for configuration. For example, to use a different JDK than the default, this may work:


To compile the driver simply run ant in the top level directory. The compiled driver will be placed in jars/postgresql.jar. The resulting driver will be built for the version of Java you are running. If you build with a 1.4 or 1.5 JDK you will build a version that supports the JDBC 3 specification and if you build with a 1.6 or higher JDK you will build a version that supports the JDBC 4 specification.

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group