How to find Confluence's database connection parameters

Still need help?

The Atlassian Community is here for you.

Ask the community

This article only applies to the Atlassian server platform. Learn more about the differences between cloud and server.

Purpose

In some cases, it might be necessary to run a SQL script against the database and the connection parameters (i.e. database name, database user) are unknown. The purpose of this article is to describe where the database connection parameters used by Confluence are stored so they can be located.

Solution

If your confluence instance connects directly via JDBC, your database connection configuration is stored in <confluence_home>/confluence.cfg.xml file. 

For example:

    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.password">confluencepass</property>
    <property name="hibernate.connection.url">jdbc:mysql://<servername>/<databasename>?autoReconnect=true</property>
    <property name="hibernate.connection.username">confluencedbuser</property>
    <property name="hibernate.database.lower_non_ascii_supported">true</property>
    <property name="hibernate.dialect">com.atlassian.hibernate.dialect.MySQLDialect</property>

Properties

hibernate.connection.driver_class

Defines the JBDC driver used to connect to the database.

hibernate.connection.password

Defines the password used to connect to the database.

hibernate.connection.url

Defines the connection string used to connect to the database.

hibernate.connection.username

Defines the username used to connect to the database.

Datasource

If you're connecting via datasource, then you will see in the confluence.cfg.xml file something like the following:

<property name="hibernate.setup">true</property>
<property name="hibernate.dialect">com.atlassian.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.datasource">java:comp/env/jdbc/confluence</property>

That is, the property "hibernate.connection.datasource" is defined. If so, your connection configuration is stored within your datasource. Each application server stores its information differently, however, if you are using Tomcat, then check your server.xml file.

DescriptionIn some cases, it might be necessary to run a SQL script against the database and the connection parameters (i.e. database name, database user) are unknown. The purpose of this article is to describe where the database connection parameters used by Confluence are stored so they can be located.
ProductConfluence
PlatformServer
Last modified on Oct 10, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.