Tomcat uses its context.xml file to create database connection pools and find the database. Shrine-setup.zip contains a sample context.xml file. Copy that file to /opt/shrine/tomcat/conf.
Here's an example of a context.xml file for a local mariaDB:
<?xml version='1.0' encoding='utf-8'?> <!-- The contents of this file will be loaded for each web application --> <Context> <WatchedResource>WEB-INF/web.xml</WatchedResource> <Resource name="jdbc/problemDB" auth="Container" type="javax.sql.DataSource" maxTotal="128" maxIdle="32" maxWaitMillis="10000" username="shrine" password="demouser" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/shrine_query_history" testOnBorrow="true" validationQuery="SELECT 1" /> <Resource name="jdbc/shrineDB" auth="Container" type="javax.sql.DataSource" maxTotal="128" maxIdle="32" maxWaitMillis="10000" username="shrine" password="demouser" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/shrine_query_history" testOnBorrow="true" validationQuery="SELECT 1" /> <Resource name="jdbc/adapterAuditDB" auth="Container" type="javax.sql.DataSource" maxTotal="128" maxIdle="32" maxWaitMillis="10000" username="shrine" password="demouser" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/adapterAuditDB" testOnBorrow="true" validationQuery="SELECT 1" /> <Resource name="jdbc/qepAuditDB" auth="Container" type="javax.sql.DataSource" maxTotal="512" maxIdle="32" maxWaitMillis="10000" username="shrine" password="demouser" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/qepAuditDB" testOnBorrow="true" validationQuery="SELECT 1" /> <Resource name="jdbc/stewardDB" auth="Container" type="javax.sql.DataSource" maxTotal="128" maxIdle="32" maxWaitMillis="10000" username="shrine" password="demouser" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/stewardDB" testOnBorrow="true" validationQuery="SELECT 1" /> </Context> |
For MariaDB you will need to use an appropriate driver. In our tests, we have had success with the MySQL Connector/J driver from https://dev.mysql.com/downloads/connector/j/. The jar file we used was mysql-connector-java-5.1.38-bin.jar. It should be installed under /opt/shrine/tomcat/lib.
For MS SQL Server, you will need to use an appropriate driver and url for your database. In our tests, we have had success with the JTS driver from https://sourceforge.net/projects/jtds/files/. The jar file we used was ds-1.3.1.jar. It should be installed under /opt/shrine/tomcat/lib.
driverClassName="net.sourceforge.jtds.jdbc.Driver" |
The URL we use looks like this:
url="jdbc:jtds:sqlserver://shrine-qa-mssql.c1pwbbhemhmx.us-east-1.rds.amazonaws.com:1433/adapterAuditDB" |
For Oracle, you will need to use an appropriate driver and url for your database. In our tests, we have had success with the Oracle DB driver from https://www.oracle.com/technetwork/database/application-development/jdbc/downloads/jdbc-ucp-19c-5460552.html. The jar file we used was ojdbc7.jar. It should be installed under /opt/shrine/tomcat/lib.
driverClassName="oracle.jdbc.OracleDriver" |
The URL we use looks like this:
url="jdbc:oracle:thin:@shrine-qa-ora.c1pwbbhemhmx.us-east-1.rds.amazonaws.com:1521:SHRINEDB" |
We also changed the validationQuery:
validationQuery="SELECT 1 FROM DUAL" |