How to find Confluence's database connection parameters
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
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.