Connecting JIRA to SQL Server 2012

ここでは、JIRA の Microsoft SQL Server 2012 データベースへの接続手順を説明します。

はじめる前に

  • 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.
  • セットアップ ウィザードを実行中でなければ、はじめる前に JIRA をシャットダウンしてください。

1. SQL Server データベースの作成と設定

  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.
    • 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 は Unicode エンコード形式で文字を格納します。これで、文字エンコード問題を十分回避できます。
  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.
    • このユーザーは SQL ユーザーに設定します。Windows ユーザーの設定および Active Directory ID の設定は行わないでください。
  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.
    • SQL Server 2012 の「スキーマ」は、オブジェクトを含むために使用されるまったく別の名前空間であり、従来のデータベーススキーマとは異なるものです。JIRA のテーブル、フィールド、または信頼関係の作成は不要です (JIRA は初回起動時に、これらのオブジェクトを空のスキーマ内に作成します)。SQL Server 2012 のスキーマに関する詳細は、Microsoft ドキュメントの関連項目を参照してください。
  4. 作成したデータベース ユーザーが、データベースに接続し、新しく作成したスキーマの中でテーブルを作成・追加できる権限を持つことを確認します。
  5. TCP/IP が SQL Server で有効になっており、適切なリスニング ポート (SQL Server インストールの既定の設定では 1433) が設定されていることを確認します。
    設定したポート番号を覚えておいてください。後のステップで JIRA をこのデータベースに接続する設定を行う際に必要となります。JIRA では動的なポート割り当てはサポートされていません。
    • ネットワーク プロトコル (TCP/IP) を有効にする方法、および、SQL Server のリスニング ポートの変更方法に関しては、Microsoft のドキュメンテーションを参照してください。
  6. SQL Server が適切な認証モードで稼働していることを確認します。
    • SQL Server はデフォルトで「Windows 認証モード」で稼働します。しかし、ユーザーが SQL Server の信頼関係接続に関連付けられていない場合、すなわち、JIRA セットアップ中に ”Microsoft SQL Server、エラー: 18452” が表示される場合、この認証モードを「混在モード」に変更する必要があります。認証モード、および、「混在モード」への認証モードの変更に関しては、Microsoft のドキュメンテーションを参照してください。
  7. SET NOCOUNT オプションのチェックを外します。(Microsoft SQL Server に関する JIRA の資料の中に、SET NOCOUNT にチェックを入れた場合のエラーに関する詳細情報があります) 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 2012. Ensure that the SET NOCOUNT option is not selected:

    • You will also need to right-click on the server to access the Properties > Connections > Default Connections properties box and clear the no count option.
    • 新規作成したデータベース上で右クリックをして、Query Console にアクセスし、 “New Query” を選択します。次のコマンドを実行し、分離レベルを設定します。

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

2. SQL Server の JDBC Driver をアプリケーションサーバーへコピー (JIRA WAR 限定)

(warning) Skip this step if you installed a 'Recommended' distribution of JIRA, which includes the SQL Server JDBC driver. The JIRA WAR distribution does not include this driver.

  1. Download the SQL Server JDBC driver (v1.2.4) from jTDS.
    (warning) Regarding Microsoft's official JDBC driver: Microsoft has its 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). The latest version haven't been tested yet, so official support cannot be guaranteed.
  2. Add the SQL Server JDBC driver jar (jtds-1.2.4.jar) to the lib/ directory.

3. SQL Server 2012 データベースへ接続するための JIRA サーバーの設定

SQL Server 2008 データベースへ接続するための JIRA サーバーの設定方法は3つあります:

  • Using the JIRA setup wizard (not applicable to JIRA WAR) — 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 (not applicable to JIRA WAR) — 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.
  • Manually — Only use this method if you have a JIRA WAR instance or you have a console-only connection to your JIRA server. You will be required to manually update the dbconfig.xml file in your JIRA Home Directory.

各設定手法の手順説明

JIRA セットアップ ウィザード

ブラウザから初めて JIRA にアクセスすると、JIRA setup wizard が表示されます。

  1. 最初の画面 の “Configure Language and Database” で、 “Database Connection” に My own database を選択します。
  2. Database Type” に ”SQL Server” を選択します。
  3. 下記の データベース接続関連フィールド を参照し、フィールド入力を行います。
  4. 接続をテストし、保存します。

JIRA 設定ツール

  1. 次のように JIRA 設定ツールを実行します。
  2. Database タブを選択し、”Database type” に ”SQL Server” を選択します。
  3. 下記の データベース接続関連フィールド を参照し、フィールド入力を行います。
  4. 接続をテストし、保存します。
  5. Jira を再起動します。 

手動

  1. Locate the dbconfig.xml file at the root of your JIRA Home Directory.
    • If this file does not exist, create the file, copy and paste the example XML code ( shown below ) into this file.
  2. Update the file, as described in the Database connection fields section below. Escape any '&' characters by adding 'amp;' to the end of each one.
    • Note, the <database-type/> element must specify your type of database, e.g. mssql. If you forget to do this and you start JIRA, your database tables may be created incorrectly. See Incorrect database type specified if this happens to you.
  3. ファイルを保存し、Jira を再起動します。

データベース接続フィールド

セットアップウィザード / 設定ツールdbconfig.xml説明
ホスト名

<url> タグに配置されます (下記の例の太字部分):<url>jdbc:jtds:sqlserver://dbserver:1433/jiradb</url>

SQL Server がインストールされたサーバーマシンのマシン名または IP アドレスです。
ポート

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

SQL Server のサーバーがリスンする TCP/IP ポートです。このフィールドが空の場合、デフォルト ポートが使用されます。
データベース

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

SQL Server データベース(JIRA のデータ保存先)の名前です。上記 ステップ 1で作成済みのはずです。
ユーザ名

<username> タグに格納されます (下記例の太字部分):
<username> jiradbuser </username>

JIRA が SQL Server サーバー接続時に使用するユーザーです。上記 ステップ 1で作成済みのはずです。
パスワード<password> タグに格納されます (下記例の太字部分):
<password> jiradbuser </password>
SQL Server サーバーが認証に使用するユーザーのパスワードです。
スキーマ<schema-name> タグ格納されます (下記例の太字部分):
<schema-name> dbo </schema-name>

SQL Server サーバーが使用するスキーマの名前です。上記 ステップ 1で作成済みのはずです。

dbconfig.xml ファイルのサンプル

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;autoCommit=false</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>

 

4. JIRA の起動

ここまでで、SQL Server データベースに接続するための JIRA の設定が完了したはずです。これで、起動できます!

  • JIRA の『推奨』ディストリビューションを使用している場合は、起動後、エラーがないかどうかログを観察します。
  • JIRA WAR ディストリビューションを使用している場合は、アプリケーションサーバーでウェブアプリケーションを再構築・再展開します。

(tick) 以上で、SQL Server データベースへの JIRA の接続は完了です。

最終更新日 2016 年 7 月 26 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.