This topic explains how to configure a PostgreSQL database as an
external data source.
A PostgreSQL database can also be used as LabKey Server's primary database server. For more information see
Install PostgreSQL (Windows) and
Install PostgreSQL (Linux, Unix or Macintosh).
The PostgreSQL Driver
LabKey Server requires the PostgreSQL driver to connect to PostgreSQL databases. Note that the LabKey Windows installer and manual install steps copies the PostgreSQL driver JAR file (postgresql.jar) to your Tomcat installation, in <tomcat-home>/lib, making it available to your LabKey Server.
To install the driver separately, see
PostgreSQL JDBC Driver.
Configure the PostgreSQL Data Source
Add a <Resource> element, to your installation's
labkey.xml configuration file. Use the configuration template below as a starting point.
Replace USERNAME and PASSWORD with the correct credentials.
If you are running LabKey Server against a remote installation of PostgreSQL, change the url attribute to point to the remote server.
<Resource name="jdbc/pgDataSource" auth="Container"
type="javax.sql.DataSource"
username="USERNAME"
password="PASSWORD"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/test"
maxActive="20"
maxIdle="10" accessToUnderlyingConnectionAllowed="true"/>
Define a New Schema
To define a new schema from the PostgreSQL data source see
Set Up an External Schema.
Related Topics
PostgreSQL JDBC Driver