Skip site navigation (1) Skip section navigation (2)


About the Driver

The PostgreSQL JDBC driver has some unique properties that you should be aware of before starting to develop any code for it. The current development driver supports eleven server versions and three java environments. This doesn't mean that every feature must work in every combination, but a reasonable behaviour must be provided for non-supported versions. While this extra compatibility sounds like a lot of work, the actual goal is to reduce the amount of work by maintaining only one code base.


The following tools are required to build and test the driver:

Build Process

After retrieving the source from the git repository. Move into the top level pgjdbc directory and simply type mvn package -DskipTests. This will build the appropriate driver for your current Java version and place it into target/postgresql-${version}.jar.

Test Suite

To make sure the driver is working as expected there are a set of JUnit tests that should be run. These require a database to run against that has the plpgsql procedural language installed. The default parameters for username and database are "test", and for password it's "test". so a sample interaction to set this up would look the following, if you enter "password" when asked for it:

postgres@host:~$ createuser -d -A test -P
Enter password for user "test": 
Enter it again: 

postgres@host:~$ createdb -U test test

postgres@host:~$ createlang plpgsql test

Now we're ready to run the tests, we simply type mvn clean package, and it should be off and running. To use non default values to run the regression tests, you can create a in the top level directory. This properties file allows you to set values for host, database, user, password, and port with the standard properties "key = value" usage. The ability to set the port value makes it easy to run the tests against a number of different server versions on the same machine.

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