Documentation for JIRA 4.3. Documentation for other versions of JIRA is available too.

Skip to end of metadata
Go to start of metadata
Gliffy Zoom Zoom

These instructions will help you connect JIRA to a Microsoft SQL Server 2008 database.

On this page:

1. Before you begin:

1.1 Export your existing JIRA data

If you are already using JIRA, 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

2. Configure SQL Server

  1. Create a database for JIRA to store issues in (e.g. jiradb). Note that the collation type must be case insensitive, e.g.: 'SQL_Latin1_General_CP437_CI_AI' is case insensitive. If it is using your server default, check the collation type of your server. Remember the name of this database, as it will be used again when configuring JIRA in steps 4 or 5 of this article.
    Icon

    SQL Server uses Unicode encoding to store characters. This is sufficient to prevent any possible encoding problems.

  2. Create a database user which JIRA will connect as (e.g. jirauser ). Note that jirauser should not be the database owner, but should be in the db_owner role. ( See SQL Startup Errors for details.)
  3. Create an empty 'schema' in the database (e.g. jiraschema) for the JIRA tables. Please note that a 'schema' in SQL Server 2008 is a distinct namespace used to contain objects, and is different from a traditional database schema. You are not required to create any of JIRA's tables, fields or relationships (JIRA will create these objects in your empty schema when it starts for the first time). You can read more on SQL Server 2008 schemas in the relevant Microsoft documentation.
  4. Ensure that the user has permission to connect to the database and create and populate tables in the newly-created schema.
  5. Ensure that TCP/IP is enabled on SQL Server and listening on the correct port (the port is 1433 for the default instance of SQL Server). Read the Microsoft documentation for information on how to enable a network protocol (TCP/IP) and how to configure SQL server to listen on a specific port.
  6. Ensure that SQL Server is operating in the appropriate authentication mode. By default, SQL Server operates in 'Windows Authentication Mode'. However, if your user is not associated with a trusted SQL connection, i.e. 'Microsoft SQL Server, Error: 18452' is received during JIRA startup, you will need to change the authentication mode to 'Mixed Authentication Mode'. Read the Microsoft documentation on authentication modes and changing the authentication mode to 'Mixed Authentication Mode'
  7. Turn off the SET NOCOUNT option. (The JIRA on MS SQL Server document provides details on the errors that occur if SET NOCOUNT is set.) To turn off SET NOCOUNT:
    • Open SQL Server Management Studio and navigate to Tools -> Options -> Query Execution -> SQL Server -> Advanced. The following screenshot displays the configuration panel for this setting in MSSQL Server 2008. Ensure that the SET NOCOUNT option is not selected:

3. Copy the SQL Server driver to your application server

Icon

Skip this step if you are using JIRA Standalone, as JIRA Standalone includes the driver.

  1. Download the SQL Server JDBC driver (v1.2.4) from JTDS.

    Note

    Icon

    Microsoft have their own JDBC driver but we have not tested JIRA with it. Previous versions of the MS JDBC driver have been known to cause issues: ( JRA-5760, JRA-6872 ), workflow problems (JRA-8443) and Chinese character problems (JRA-5054).

  2. Add the SQL Server JDBC driver jar (jtds-1.2.4.jar) to the lib/ directory.

4. Use the JIRA Configuration Tool

Icon

You can either use the configuration tool (this section) or configure the corresponding XML file manually (see Section 5)

Icon

The JIRA Configuration Tool is a GUI tool only available if you are using JIRA Standalone distribution. If you are running a WAR-EAR distribution of JIRA, or have a text-only connection to the JIRA server, you will need to configure the files manually.

The JIRA Configuration Tool requires that Java be installed and configured on your operating system. We recommend using a Java platform supported by JIRA — refer to JIRA Requirements for details.

The Configuration Tool will display your current configuration settings if any are already set.

(info) Please Note: You may need to set the JAVA_HOME environment variable to run the JIRA Configuration Tool. See Installing Java for details.

  1. Click the 'Database' tab.
  2. From the 'Database type' drop-down choose 'SQL Server'.
  3. Fill in the connection details for your SQL Server database:
    • Hostname — The name or IP address of the machine that SQL Server is installed on.
    • Port — The TCP/IP port that SQL Server is listening on. You can leave this blank to use the default port.
    • Database — The database that you will be connecting to. (the database name set from step 2 of this article)
    • Username — The user to connect to SQL Server as.
    • Password — The password to use to authenticate with SQL Server.
    • Schema — The schema that you want the DB tables created under.
  4. After typing in your settings, use 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.
  5. Click 'Save' to save your settings when you are done.
  6. Restart JIRA in order for your new settings to take effect.

Congratulations — you have finished!

5. Configure the database connection manually

Icon

Skip this step if you used the JIRA Configuration Tool (see above).

5.1 Configure your application server to connect to SQL Server

  1. Edit the server configuration file and customise the username , password , driverClassName and url parameters for the Datasource, as shown in the code sample below.
    • If you are using JIRA Standalone, the server configuration file that you need to edit is  conf/server.xml .
    • If you are using JIRA WAR/EAR, edit the appropriate file on your application server, e.g. for Tomcat, edit  conf/Catalina/localhost/jira.xml .
Icon

If you have a named instance, your string may look like url="jdbc:jtds:sqlserver://localhost:1433/jiradb;instance=instance_name"

(info) If you can't find this section at all, you've probably got the wrong file — search for mentions of 'jira' in the files under conf/ .

Icon

If you are using JIRA Standalone, you will also need to edit conf/server.xml , and delete the  minEvictableIdleTimeMillis  and  timeBetweenEvictionRunsMillis  attributes. These attributes are only needed for HSQL, and will degrade performance if they are not removed.

5.2 Configure the JIRA Entity Engine

  1. #* Edit the JIRA Entity Engine configuration file and change the field-type-name attribute to mssql.
    • If you are using JIRA Standalone, the JIRA Entity Engine configuration file that you need to edit is atlassian-jira/WEB-INF/classes/entityengine.xml .
    • If you are using JIRA WAR/EAR, the JIRA Entity Engine configuration file that you need to edit is  edit-webapp/WEB-INF/classes/entityengine.xml . If you forget to do to make this change and start JIRA, it may create database tables incorrectly. See this page if this happens to you.
  2. Change schema-name="PUBLIC" to the name of the schema associated with the database (i.e. the schema you created in step 1.3 above), e.g. schema-name="jira" . Note that the schema must exist in the database before you perform this step.
Icon

If you are using JIRA WAR/EAR, your application server may require other changes to entityengine.xml (e.g. to customise the jndi-jdbc tag).

5.3 Next steps

You should now have an application server configured to connect to a database, and JIRA configured to use the correct database type. The next step is to start it up!

  • If you are using JIRA Standalone, start it up and watch the logs for any errors.
  • If you are using JIRA WAR/EAR, rebuild and redeploy the webapp in your application server.
    Once you have the JIRA server running, you can try accessing the JIRA application in your browser.

Installation notes

Please see JIRA and MS SQL Server 2008.