---
title: "Configure Application Server-based Data Sources"
canonical: "https://support.appfire.com/space/SQL/74318881/Configure%20Application%20Server-based%20Data%20Sources"
format: markdown
---
> Macro (aura-html)

# Summary

# Confluence Installation With Tomcat

Many users install the standard Confluence standalone distribution that includes Tomcat. This section will discuss configuration specific to this application server environment. The most recent versions of Confluence use newer versions of the Tomcat application server where the following configuration examples apply:

## JDBC Driver Location

Put the driver jar in **<install-dir>/lib** - this is the directory that has other tomcat jars. If you have a **much older version of Confluence** that does not have this directory, look for **<install-dir>/common/lib** instead.

## Tomcat Configuration

Modify **<install-dir>/conf/server.xml** to add one or more Data Source resource elements.   is an example of adding a few Data Sources for various local and non-local databases.

The essential element is something like the following where the **Data Source** name is **myDS**:

```
<Resource name="jdbc/myDS"
    auth="Container" 
    type="javax.sql.DataSource" 
    username="confluence" 
    password="confluence"
    maxTotal="25"
    maxWaitMillis="10000"
    maxIdle="10"
    driverClassName="org.postgresql.Driver"
    url="jdbc:postgresql://localhost:5432/mydatabase"
    validationQuery="Select 1"
/>

```

> ✅ **Resource must be within the confluence context tag**
> ✅ 
> ✅ ```
> ✅ ...
> ✅ <Context path="" docBase="../confluence" debug="0" reloadable="false">
> ✅ ...
> ✅ <Resource ... />
> ✅ ...
> ✅ </Context>
> ✅ 
> ✅ 
> ✅ ```

> ✅ **Consider using a validation query**
> ✅ 
> ✅ See [this stack overflow question](http://stackoverflow.com/questions/15393954/what-is-a-validationquery-with-respect-to-databases-and-jndi).


---

# Database Examples

The **sql** macro markup would be: **{sql:dataSource=myDS| ... }**  

See [Examples](https://appfire.atlassian.net/wiki/spaces/SQL/pages/74318485/Examples).

# Further Configuration Management

See [How to limit active database connections](https://appfire.atlassian.net/wiki/spaces/SQL/pages/74317986)

# Other Databases

Support for other databases depends on the capabilities provided by the JDBC driver. [SQL for Confluence](https://appfire.atlassian.net/wiki/spaces/SQL) expects certain JDBC features to be available. In some cases, parameter choices can affect which capabilities are needed. User testing and community support is about the only help that is available for less popular databases/JDBC drivers. If you have had success with other databases, please add information to this page.

---

# Problem determination

See [Troubleshooting Application Server-based Data Sources](https://appfire.atlassian.net/wiki/spaces/SQL/pages/74319387/Troubleshooting+Application+Server-based+Data+Sources).

> Macro (include)