Connecting JIRA applications to SQL Server 2008

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

Before you begin

  • Check whether your version of SQL Server is supported. See Supported platforms.
    Note, SQL Server Express is not supported, however, it is possible to set up JIRA to work with this database.
  • 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.
  • Shut down JIRA before you begin, unless you are running the Setup Wizard.

On this page:

1. Create and Configure the SQL Server Database

  1. Create a database for JIRA to store issues in (e.g. jiradb).
    Remember your database name, as it will be used to configure JIRA's connection to this database in subsequent steps.
    • Collation type must be case-insensitive. We support 'SQL_Latin1_General_CP437_CI_AI' and 'Latin1_General_CI_AI' as case-insensitive, accent-insensitive, and language neutral collation types. 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).
    Remember your database user name, as it will be used to configure JIRA's connection to this database in subsequent steps.
    • This database user should not be the database owner, but should be in the db_owner role.
  3. Create an empty 'schema' in the database (e.g. jiraschema ) for the JIRA tables.
    Remember this database schema name, as it will be used to configure JIRA's connection to this database in subsequent steps.
    • 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).
    Remember this port number, as it will be used to configure JIRA's connection to this database in subsequent steps. JIRA does not support dynamic port assignment.
    • 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. 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:

    • You will also need to access the Server > Properties > Connections > Default Connections properties box and clear the no count option.
    • Access the Query Console by right clicking on the newly created database and selecting 'New Query'. Execute the following command to set the isolation level.

      ALTER DATABASE THE-NEW-DATABASE-CREATED-FOR-JIRA SET READ_COMMITTED_SNAPSHOT ON 

2. 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 database:

  • Using the JIRA setup wizard  — Use this method, if you have just installed JIRA and are setting it up for the first time. Your settings will be saved to the dbconfig.xml file in your JIRA home directory.
  • Using the JIRA configuration tool — Use this method, if you have an existing JIRA instance. Your settings will be saved to the dbconfig.xml file in your JIRA home directory.

Instructions for each configuration method

JIRA setup wizard

The JIRA setup wizard will display when you access JIRA for the first time in your browser.

  1. In the first screen, 'Configure Language and Database', set Database Connection to My own database.
  2. Set Database Type to SQL Server.
  3. Fill out the fields, as described in the Database connection fields section below.
  4. Test your connection and save.

JIRA configuration tool

  1. Run the JIRA configuration tool as follows:
  2. Navigate to the Database tab and set Database type to SQL Server.
  3. Fill out the fields, as described in the Database connection fields section below.
  4. Test your connection and save.
  5. Restart JIRA.

Database connection fields

Setup Wizard / Configuration Tool dbconfig.xml Description
Hostname

Located in the <url> tag (bold text in example below):<url>jdbc:jtds:sqlserver://dbserver:1433/jiradb</url>

The name or IP address of the machine that the SQL Server server is installed on.
Port

Located in the <url> tag (bold text in example below):
<url>jdbc:jtds:sqlserver://dbserver:1433/jiradb</url>

The TCP/IP port that the SQL Server server is listening on. You can leave this blank to use the default port.
Database

Located in the <url> tag (bold text in example below):
<url>jdbc:jtds:sqlserver://dbserver:1433/jiradb</url>

The name of your SQL Server database (into which JIRA will save its data). You should have created this in Step 1 above.
Username

Located in the <username> tag (see bold text in example below):
<username> jiradbuser </username>

The user that JIRA uses to connect to the SQL Server server. You should have created this in Step 1 above.
Password Located in the <password> tag (see bold text in example below):
<password> jiradbuser </password>
The user's password — used to authenticate with the SQL Server server.
Schema Located in the <schema-name> tag (see bold text in example below):
<schema-name> dbo </schema-name>

The name of the schema that your SQL Server database uses. You should have created this in Step 1 above.

Sample dbconfig.xml file

For more information about the child elements of <jdbc-datasource/> beginning with pool in the dbconfig.xml file above, see Tuning database connections.

<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>password</password>
  <pool-min-size>20</pool-min-size>
  <pool-max-size>20</pool-max-size>
  <pool-max-wait>30000</pool-max-wait>
  <pool-max-idle>20</pool-max-idle>
  <pool-remove-abandoned>true</pool-remove-abandoned>
  <pool-remove-abandoned-timeout>300</pool-remove-abandoned-timeout>
 
  <validation-query>select 1</validation-query>
  <min-evictable-idle-time-millis>60000</min-evictable-idle-time-millis>
  <time-between-eviction-runs-millis>300000</time-between-eviction-runs-millis>

  <pool-test-while-idle>true</pool-test-while-idle>
</jdbc-datasource>
</jira-database-config>

 

3. Start JIRA

You should now have JIRA configured to connect to your SQL Server database. The next step is to start it up!

(tick) Congratulations, you now have JIRA connected to your SQL Server database.

Was this helpful?

Thanks for your feedback!

Why was this unhelpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport