These instructions will help you connect JIRA to a PostgreSQL 8.2+ database.
1. Before You Begin1.1 Are You Migrating JIRA to Another Server?If you are Migrating JIRA to Another Server, create an export of your data as an XML backup. You will then be able to transfer data from your old database to your new database, as described in Switching databases. 1.2 Shut Down JIRA | On this page:
|
2. Create and Configure the PostgreSQL Database
- Create a database user which JIRA will connect as (e.g.
jiradbuser).
Remember this database user name, as it will be used to configure JIRA's connection to this database in subsequent steps. Create a database for JIRA to store issues in (e.g.
jiradb) with Unicode collation.CREATE DATABASE jiradb WITH ENCODING 'UNICODE';
Or from the command-line:
$ createdb -E UNICODE jiradb
- Ensure that the user has permissions to connect to the database, and to create and write to tables in the database.
Remember this database name, as it will be used to configure JIRA's connection to this database in subsequent steps.
3. Copy the PostgreSQL JDBC Driver to Your Application Server (JIRA WAR Only)
Skip this step if you installed a 'Recommended' distribution of JIRA, which (unlike JIRA WAR) includes the PostgreSQL JDBC driver.
- Download the PostgreSQL JDBC driver from http://jdbc.postgresql.org/download.html. (Obtain version 8.4 of the JDBC 4 driver.)
- Add the PostgreSQL JDBC driver jar to the
lib/directory of your application server.
4. Configure Your JIRA Server to Connect to Your PostgreSQL Database
There are two ways to configure your JIRA server to connect to your PostgreSQL database:
- Using the JIRA Configuration Tool (except JIRA WAR distributions) or
- Manually
Please Note:
- The JIRA Configuration Tool requires a Java platform to be installed and configured on your operating system. We recommend using a Java platform supported by JIRA — refer to JIRA Requirements for details.
- If you use the JIRA WAR distribution or have a console-only connection to your JIRA server, you will need to configure JIRA with PostgreSQL manually.
4.1 Connecting JIRA to PostgreSQL Using the JIRA Configuration Tool
The JIRA Configuration Tool is not available with JIRA WAR distributions.
To start the JIRA Configuration Tool:
- On Windows:
Open a command prompt and runconfig.batin thebinsubdirectory of the JIRA Installation Directory. - On Linux/Unix:
Open a console and executeconfig.shin thebinsubdirectory of the JIRA Installation Directory.
Please Note: You may need to set the JAVA_HOME environment variable to run the JIRA Configuration Tool. See Installing Java for details.
To connect JIRA to PostgreSQL using the JIRA Configuration Tool:
- Click the 'Database' tab.
- From the 'Database type' drop-down choose 'PostgreSQL'.
The JIRA Configuration Tool will display your current database configuration settings if any are already set.

- Fill in the connection details for your PostgreSQL database.
- 'Hostname' — The name or IP address of the machine that the PostgreSQL server is installed on.
- 'Port' — The TCP/IP port that the PostgreSQL server is listening on. You can leave this blank to use the default port.
- 'Database' — The name of your PostgreSQL database (into which JIRA will save its data).
- 'Username' — The user that JIRA uses to connect to the PostgreSQL server.
- 'Password' — The user's password to authenticate with the PostgreSQL server.
- 'Schema' — The name of the schema that your PostgreSQL database uses.
Please ensure your database's schema name is lower-case as JIRA cannot work with PostgreSQL databases whose schema names contain upper-case characters.
- JIRA keeps a pool of database connections open to the database server. You can set the maximum size of this pool in the 'Pool Size' text field.
- After typing in your settings, click the 'Test Connection' button to test the connection settings. The tool will attempt to connect to the database, and give a message with the results.
- Click 'Save' to save your settings when you are done.
Please Note:- The JIRA Configuration Tool will save your database configuration to a
dbconfig.xmlfile in your JIRA Home Directory. - JIRA must be restarted for your new settings to take effect.
- The JIRA Configuration Tool will save your database configuration to a
Congratulations — you have finished! Proceed to 'Next Steps' below.
4.2 Connecting JIRA to PostgreSQL Manually
Edit the
dbconfig.xmlfile at the root of your JIRA Home Directory.
If this file does not exist, create the file, copy and paste the example XML code below into this file and edit the pasted XML as required.
Please Note: Ensure that the
<database-type/>element's content specifies your type of database, as shown below. If you forget to do this and you start JIRA, your database tables may be created incorrectly. Refer to our Incorrect database type specified documentation if this happens to you.
PostgreSQL 7.2 and later requires a schema to be specified in the<schema-name/>element. If your PostgreSQL database uses the default 'public' schema, this should be specified in the<schema-name/>element as shown below. Please ensure your database's schema name is lower-case as JIRA cannot work with PostgreSQL databases whose schema names contain upper-case characters.
When editing your dbconfig.xmlfile, escape any '&' characters by adding 'amp;' to the end of each one.<?xml version="1.0" encoding="UTF-8"?> <jira-database-config> <name>defaultDS</name> <delegator-name>default</delegator-name> <database-type>postgres72</database-type> <schema-name>public</schema-name> <jdbc-datasource> <url>jdbc:postgresql://dbserver:5432/jiradb</url> <driver-class>org.postgresql.Driver</driver-class> <username>jiradbuser</username> <password>[enter db password]</password> <pool-size>15</pool-size> </jdbc-datasource> </jira-database-config>- Save your edited
dbconfig.xmlfile (at the root of your JIRA Home Directory).
JIRA must be restarted for your new settings to take effect.
5. Next steps
You should now have JIRA configured to connect to your PostgreSQL database.
- If you are using a 'recommended' distribution of JIRA, start it up and watch the logs for any errors.
- If you are using the JIRA WAR distribution, rebuild and redeploy the webapp in your application server.
Installation notes
Please see JIRA and PostgreSQL.