Configuring a MySQL Datasource in Apache Tomcat

Confluence is very helpful to share work with your team members, if and when you have to. It’s a centralized place where you can work together on projects

This articles help you to set up a MySQL datasource connection for Confluence.


Step 1: Shut down Tomcat

Run following command to bring Tomcat down while you are making these changes.

# ./

Step 2: MySQL database driver

You need to make the MySQL JDBC driver available to your application server, as described in the appropriate setup guide.

Step 3: Configure Tomcat

Edit server.xml file in your Tomcat installation.

# vim <CONFLUENCE_INSTALLATION>/conf/server.xml

Find the following lines:

<Context path="" docBase="../confluence" debug="0" reloadable="true">
  <!-- Logger is deprecated in Tomcat 5.5. Logging configuration for Confluence is specified in confluence/WEB-INF/classes/ -->

Insert the DataSource Resource element within the Context element.

<Resource name="jdbc/confluence" auth="Container" type="javax.sql.DataSource"
         validationQuery="Select 1" />

username: Database username to be gone to your JDBC driver.
password: Database password to be gone to your JDBC driver.
driverClassName: Completely qualified Java class name of the JDBC driver to be utilized.
url: Connection URL to be gone to your JDBC driver.
maxActive: The greatest number of active instances that can be allocated from this pool in the meantime.
maxIdle: The greatest number of connections that can sit in this pool in the meantime.
validationQuery: SQL inquiry that can be utilized by the pool to approve connections before they are come back to the application.

Step 4: Configure the Confluence web application

Edit server.xml file in your Confluence installation.

# vim <CONFLUENCE_INSTALLATION>/confluence/WEB-INF/web.xml

Embed the following component just before </web-app> close to the end of the file:

    <description>Connection Pool</description>

Step 5: Start Tomcat

Run following command to bring Tomcat up while you are making these changes.

# ./

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.