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 OSX).

The PostgreSQL JDBC Driver

LabKey Server requires the PostgreSQL JDBC driver to connect to PostgreSQL databases. The PostgreSQL JDBC driver JAR file (postgresql.jar) must be copied to your Tomcat installation in the <tomcat-home>/lib directory.

For more information, 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

Was this content helpful?

Log in or register an account to provide feedback


previousnext
 
expand allcollapse all