製品をチェック

無償トライアル:

無償トライアルへ

製品の情報と無償トライアルへ:

Jira Service Desk JDBC Driver

Jira Service Desk データに連携するJava アプリケーションを素早く、簡単に開発できる便利なドライバー。

データ連携でお困りですか?

お問い合わせ

JRuby からJira Service Desk にデータ連携


リアルタイムJira Service Desk に連携するシンプルなJRuby アプリケーションを作成します。


加藤龍彦
ウェブデベロッパー

jiraservicedesk ロゴ画像

JDBC Driver

jdbc ロゴ画像
JRuby ロゴ画像

JRuby はRuby プログラミング言語の高性能で安定した、完全にスレッド化されたJava 実装です。CData JDBC Driver for JiraServiceDesk を使用すると、JRuby からリアルタイムJira Service Desk へのデータ連携を簡単に実装できます。ここでは、Jira Service Desk に接続し、クエリを実行して結果を表示する簡単なJRuby アプリを作成する方法を説明します。

Jira Service Desk データにJDBC で接続

アプリを作成する前に、JDBC Driver のJAR ファイルのインストール場所をメモします。 (通常はC:\Program Files\CDatat\CData JDBC Driver for JiraServiceDesk\libにあります。)

JRuby は、JDBC をネイティブにサポートしているため、簡単にJira Service Desk に接続してSQL クエリを実行できます。java.sql.DriverManager クラスのgetConnection 関数を使用してJDBC 接続を初期化します。

You can establish a connection to any Jira Service Desk Cloud account or Server instance.

Connecting with a Cloud Account

To connect to a Cloud account, you'll first need to retrieve an APIToken. To generate one, log in to your Atlassian account and navigate to API tokens > Create API token. The generated token will be displayed.

Supply the following to connect to data:

  • User: Set this to the username of the authenticating user.
  • APIToken: Set this to the API token found previously.

Connecting with a Service Account

To authenticate with a service account, you will need to supply the following connection properties:

  • User: Set this to the username of the authenticating user.
  • Password: Set this to the password of the authenticating user.
  • URL: Set this to the URL associated with your JIRA Service Desk endpoint. For example, https://yoursitename.atlassian.net.

Note: Password has been deprecated for connecting to a Cloud Account and is now used only to connect to a Server Instance.

Accessing Custom Fields

By default, the connector only surfaces system fields. To access the custom fields for Issues, set IncludeCustomFields.

ビルトイン接続文字列デザイナー

JDBC URL の構成については、Jira Service Desk JDBC Driver に組み込まれている接続文字列デザイナーを使用してください。JAR ファイルのダブルクリック、またはコマンドラインからJAR ファイルを実行します。

java -jar cdata.jdbc.jiraservicedesk.jar

接続プロパティを入力し、接続文字列をクリップボードにコピーします。

Using the built-in connection string designer to generate a JDBC URL (Salesforce is shown.)

以下はJira Service Desk の一般的なJDBC 接続文字列です。

jdbc:jiraservicedesk:ApiKey=myApiKey;User=MyUser;InitiateOAuth=GETANDREFRESH

Jira Service Desk データへの接続性を持つJRuby アプリを作成

新しいRuby ファイル(例: JiraServiceDeskSelect.rb) を作成してテキストエディタで開き、次のコードをファイルにコピーします。

require 'java' require 'rubygems' require 'C:/Program Files/CData/CData JDBC Driver for JiraServiceDesk 2018/lib/cdata.jdbc.jiraservicedesk.jar' url = "jdbc:jiraservicedesk:ApiKey=myApiKey;User=MyUser;InitiateOAuth=GETANDREFRESH" conn = java.sql.DriverManager.getConnection(url) stmt = conn.createStatement rs = stmt.executeQuery("SELECT RequestId, ReporterName FROM Requests") while (rs.next) do puts rs.getString(1) + ' ' + rs.getString(2) end

ファイルが完成したら、コマンドラインからファイルを実行するだけでJRuby でJira Service Desk を表示できるようになります。

jruby -S JiraServiceDeskSelect.rb

SQL-92 クエリをJira Service Desk に書き込むと、Jira Service Desk を独自のJRuby アプリケーションに素早く簡単に組み込むことができます。今すぐ無料トライアルをダウンロードしましょう。