<html><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 2. Setting up the JDBC Driver</title><meta content="DocBook XSL Stylesheets V1.78.1" name="generator"><link rel="home" href="index.html" title="The PostgreSQL™ JDBC Interface"><link rel="up" href="index.html" title="The PostgreSQL™ JDBC Interface"><link rel="prev" href="intro.html" title="Chapter 1. Introduction"><link rel="next" href="classpath.html" title="Setting up the Class Path"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table summary="Navigation header" width="100%"><tr><th align="center" colspan="3">Chapter 2. Setting up the <acronym class="acronym">JDBC</acronym> Driver</th></tr><tr><td align="left" width="20%"><a accesskey="p" href="intro.html">Prev</a> </td><th align="center" width="60%"> </th><td align="right" width="20%"> <a accesskey="n" href="classpath.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="setup"></a>Chapter 2. Setting up the <acronym class="acronym">JDBC</acronym> Driver</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="sect1"><a href="setup.html#build">Getting the Driver</a></span></dt><dt><span class="sect1"><a href="classpath.html">Setting up the Class Path</a></span></dt><dt><span class="sect1"><a href="prepare.html">Preparing the Database Server for <acronym class="acronym">JDBC</acronym></a></span></dt><dt><span class="sect1"><a href="your-database.html">Creating a Database</a></span></dt></dl></div><p> This section describes the steps you need to take before you can write or run programs that use the <acronym class="acronym">JDBC</acronym> interface. </p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="build"></a>Getting the Driver</h2></div></div></div><p> Precompiled versions of the driver can be downloaded from the <a class="ulink" href="http://jdbc.postgresql.org" target="_top"><span class="productname">PostgreSQL</span>™ <acronym class="acronym">JDBC</acronym> web site</a>. </p><p> 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 <acronym class="acronym">JDBC</acronym> driver, you need <span class="application">Ant</span> 1.5 or higher and a <acronym class="acronym">JDK</acronym>. <span class="application">Ant</span> is a special tool for building Java-based packages. It can be downloaded from the <a class="ulink" href="http://ant.apache.org/index.html" target="_top"><span class="application">Ant</span> web site</a>. </p><p> If you have several Java compilers installed, it depends on the Ant configuration which one gets used. Precompiled <span class="application">Ant</span> distributions are typically set up to read a file <code class="filename">.antrc</code> in the current user's home directory for configuration. For example, to use a different <acronym class="acronym">JDK</acronym> than the default, this may work: </p><pre class="programlisting"> JAVA_HOME=/usr/local/jdk1.6.0_07 JAVACMD=$JAVA_HOME/bin/java </pre><p> </p><p> To compile the driver simply run <span class="command"><strong>ant</strong></span> in the top level directory. The compiled driver will be placed in <code class="filename">jars/postgresql.jar</code>. The resulting driver will be built for the version of Java you are running. If you build with a 1.4 or 1.5 <acronym class="acronym">JDK</acronym> you will build a version that supports the <acronym class="acronym">JDBC</acronym> 3 specification and if you build with a 1.6 or higher <acronym class="acronym">JDK</acronym> you will build a version that supports the <acronym class="acronym">JDBC</acronym> 4 specification. </p></div></div><div class="navfooter"><hr><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%"><a accesskey="p" href="intro.html">Prev</a> </td><td align="center" width="20%"> </td><td align="right" width="40%"> <a accesskey="n" href="classpath.html">Next</a></td></tr><tr><td valign="top" align="left" width="40%">Chapter 1. Introduction </td><td align="center" width="20%"><a accesskey="h" href="index.html">Home</a></td><td valign="top" align="right" width="40%"> Setting up the Class Path</td></tr></table></div></body></html>