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

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

1. Before You Begin

1.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 SQL Server Database

  1. Create a database for JIRA to store issues in (e.g. jiradb). (tick) Remember this database name, as it will be used to configure JIRA's connection to this database in subsequent steps.
    (info) Please Note:
    • Collation type must be case-insensitive, for example, 'SQL_Latin1_General_CP437_CI_AI' is case-insensitive collation type. If your SQL Server installation's collation type settings have not been changed from their defaults, check the collation type settings.
    • 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. jiradbuser). (tick) Remember this database user name, as it will be used to configure JIRA's connection to this database in subsequent steps.
    (info) This database user should not be the database owner, but should be in the db_owner role. (See SQL Server Startup Errors for details.)
  3. Create an empty 'schema' in the database (e.g. jiraschema) for the JIRA tables. (tick) Remember this database schema name, as it will be used to configure JIRA's connection to this database in subsequent steps.
    (info) 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 database 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 (which is 1433 for a default SQL Server installation). (tick) Remember this port number, as it will be used to configure JIRA's connection to this database in subsequent steps.
    (info) 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 JDBC Driver to Your Application Server (JIRA WAR Only)

(warning) Skip this step if you are using JIRA Standalone distribution. JIRA Standalone includes the SQL Server JDBC driver.

  1. Download the SQL Server JDBC driver (v1.2.4) from JTDS.
    (warning) 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 and 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. Configure Your JIRA Server to Connect to Your SQL Server 2008 Database

There are two ways to configure your JIRA server to connect to your SQL Server 2008 database:

(info) Please Note:

4.1 Connecting JIRA to SQL Server 2008 Using the JIRA Configuration Tool

(info) The JIRA Configuration Tool is only available with JIRA Standalone.

To start the JIRA Configuration Tool:

(info) 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 SQL Server 2008 using the JIRA Configuration Tool:

  1. Click the 'Database' tab.
  2. From the 'Database type' drop-down choose 'SQL Server'.
    (info) The JIRA Configuration Tool will display your current database configuration settings if any are already set.
  3. Fill in the connection details for your SQL Server 2008 database.
    • 'Hostname' — The name or IP address of the machine that the SQL Server 2008 server is installed on.
    • 'Port' — The TCP/IP port that the SQL Server 2008 server is listening on. You can leave this blank to use the default port.
    • 'Database' — The name of your SQL Server 2008 database (into which JIRA will save its data).
    • 'Username' — The user that JIRA uses to connect to the SQL Server 2008 server.
    • 'Password' — The user's password to authenticate with the SQL Server 2008 server.
    • 'Schema' — The name of the schema that your SQL Server 2008 database uses.
      (info) You might need to change this from the default 'dbo'.
  4. 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.
  5. 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.
  6. Click 'Save' to save your settings when you are done.
    (info) Please Note:
    • The JIRA Configuration Tool will save your database configuration to a dbconfig.xml file in your JIRA Home Directory.
    • JIRA must be restarted for your new settings to take effect.

Congratulations — you have finished! Proceed to 'Next Steps' below.

4.2 Connecting JIRA to SQL Server 2008 Manually

  1. Edit the dbconfig.xml file at the root of your JIRA Home Directory.
    (info)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.
    Also ensure that the <schema-name/> element's content matches the name of the SQL Server's schema specified when creating your JIRA database (above).
    If you have a named SQL Server instance, your <url/> element's content may look similar to — jdbc:jtds:sqlserver://dbserver:1433/jiradb;instanceName=instance_name

    (warning) When editing your dbconfig.xml file, 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>mssql</database-type>
      <schema-name>jiraschema</schema-name>
      <jdbc-datasource>
        <url>jdbc:jtds:sqlserver://dbserver:1433/jiradb</url>
        <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
        <username>jiradbuser</username>
        <password>[enter db password]</password>
        <pool-size>15</pool-size>
      </jdbc-datasource>
    </jira-database-config>
    
  2. Save your edited dbconfig.xml file (at the root of your JIRA Home Directory).
    (info) JIRA must be restarted for your new settings to take effect.

5. Next steps

You should now have JIRA configured to connect to your SQL Server database. 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, rebuild and redeploy the webapp in your application server.

Installation notes

Please see JIRA and MS SQL Server 2008.