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 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, placing it in the <tomcat-home>/lib directory, 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.

Note: This template applies to Tomcat 8 (or later). If you are using Tomcat 7, use the earlier template version in the documentation archives.

   <Resource name="jdbc/pgDataSource" auth="Container"
type="javax.sql.DataSource"
username="USERNAME"
password="PASSWORD"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/test"
maxTotal="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

Discussion

Was this content helpful?

Log in or register an account to provide feedback


previousnext
 
expand all collapse all