Java module : configuring external data sources in labkey.xml | Jon (LabKey DevOps) | 2015-03-09 14:49 |
Status: Closed | ||
Hi Bront, So what you will want to do is to add an additional entry to your labkey.xml file that resides under the LABKEY_ROOT/webapps/ directory in your dev instance. This specific XML file acts as the template and creates a labkey.xml file that gets copied to the TOMCAT folder under TOMCAT_HOME/conf/Catalina/localhost/. By default, the first few lines of that labkey.xml file will look like this: =============== <?xml version='1.0' encoding='utf-8'?> <Context docBase="@@appDocBase@@" debug="0" reloadable="true" crossContext="true"> <Resource name="jdbc/labkeyDataSource" auth="Container" type="javax.sql.DataSource" username="@@jdbcUser@@" password="@@jdbcPassword@@" driverClassName="@@jdbcDriverClassName@@" url="@@jdbcURL@@" maxActive="20" maxIdle="10" accessToUnderlyingConnectionAllowed="true" validationQuery="SELECT 1" /> <Resource name="mail/Session" auth="Container" type="javax.mail.Session" mail.smtp.host="@@smtpHost@@" mail.smtp.user="@@smtpUser@@" mail.smtp.port="@@smtpPort@@"/> =============== The data in the @@ sections retrieve their information from the LABKEY_ROOT/server/config.properties file. So you will want to add another entry to the XML file like this (my example uses a PostgreSQL Data Source): =============== <?xml version='1.0' encoding='utf-8'?> <Context docBase="@@appDocBase@@" debug="0" reloadable="true" crossContext="true"> <Resource name="jdbc/labkeyDataSource" auth="Container" type="javax.sql.DataSource" username="@@jdbcUser@@" password="@@jdbcPassword@@" driverClassName="@@jdbcDriverClassName@@" url="@@jdbcURL@@" maxActive="20" maxIdle="10" accessToUnderlyingConnectionAllowed="true" validationQuery="SELECT 1" /> <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"/> <Resource name="mail/Session" auth="Container" type="javax.mail.Session" mail.smtp.host="@@smtpHost@@" mail.smtp.user="@@smtpUser@@" mail.smtp.port="@@smtpPort@@"/> =============== This will create a permanent data source to your labkey.xml file during development and will not get overwritten when you do any build updates. For more information on configuring a specific external data source, please visit the link below: https://www.labkey.org/wiki/home/Documentation/page.view?name=externalSchemas#config Regards, Jon |
||