SSRS レポートサーバーにADO.NET Provider を配置してGoogle Translate 連携

加藤龍彦
加藤龍彦
デジタルマーケティング
SSRS レポートサーバーからGoogle Translate のデータに連携してレポートを作成。ネイティブモードレポートサーバーでも、SharePoint farm でも。



この記事では、CData ADO.NET Provider for API をSSRS レポートサーバーで配布する方法を説明します。また、共有データソースも作成します;共有データソースは、複数の帳票からリアルタイムGoogle Translate への接続を可能にします。共有データソースへは、Visual Studio のレポートデザイナーから接続できます。

ADO.NET Provider の配置

ネイティブモードのレポートサーバー、およびSharePoint server farm の一部としてインストールされたレポートサーバーに、同じ手順でプロバイダーを配布できます。プロバイダーに同梱されているInstallProvider.exe ユーティリティを使って、レポートサーバーにプロバイダーを配布します。InstallProvider.exe は、プロバイダーのインストールディレクトリの[lib]ブフォルダ内にあります。SQL サーバーのバージョン用のexe ファイルとSSRS フォルダを、配布するマシンにコピーします。/installssrs flag でexe ファイルを実行します。

.\InstallProvider.exe /installssrs PathToFolderWithSSRSDLL

Google Translate に共有データソースを作成

レポートサーバーから直接、またはSharePoint サイトから共有データソースを作成できます。あるいは、レポートデザイナーを使って作成することも可能です。

レポートデザイナー

レポートデザイナーを使って、ネイティブモードのレポートサーバーまたはSharePoint server farm のレポートサーバーで、共有データソースを作成できます。

  1. In a Report Server Project in Visual Studio, right-click Shared Data Sources in Solution Explorer and click Add New Data Source.
  2. Enter a name for the data source and in the Type menu select CData API Report.
  3. In the Connection String box, enter the connection string to connect to Google Translate. A typical connection string is below:
    Profile=C:\profiles\GoogleTranslate.apip;AuthScheme=OAuth;InitiateOAuth=GETANDREFRESH;OAuthClientId=your_client_id;OAuthClientSecret=your_client_secret;CallbackUrl=your_callback_url;

    認証

    Google Cloud Translation API では、翻訳サービス、データセット、用語集、適応型 MT リソースへの安全なアクセスを確保するために、OAuth 2.0 認証が必要です。この認証方式により、Google Cloud プロジェクトに安全に接続し、適切な認可のもとで翻訳リソースを管理できます。

    OAuth 2.0 のセットアップと設定

    ステップ 1:Google Cloud プロジェクトの作成と API の有効化

    OAuth 認証をセットアップするには、以下のステップで進めます:

    1. Google Cloud Console にアクセスします
    2. 新しいプロジェクトを作成するか、既存のプロジェクトを選択します
    3. Project ID を控えておきます(すべての API 呼び出しで必要です)
    4. 「APIs & Services」 > 「Library」に移動します
    5. 「Cloud Translation API」を検索して有効化します
    6. 「APIs & Services」 > 「Credentials」に移動します
    7. 「Create Credentials」をクリックし、「OAuth Client ID」を選択します
    8. プロンプトが表示されたら OAuth 同意画面を設定します
    9. 用途に応じて「Desktop application」または「Web application」を選択します
    10. 承認済みリダイレクト URI(CallbackURL)を設定します
    11. 接続で使用する Client ID と Client Secret をコピーします

    必須の接続プロパティ

    • AuthScheme:OAuth に設定します(必須)
    • OAuthClientId:Google Cloud Console の Client ID(必須)
    • OAuthClientSecret:Google Cloud Console の Client Secret(必須)
    • CallbackURL:OAuth アプリケーションで指定したリダイレクト URI(必須)
    • InitiateOAuth:トークンを自動管理するには GETANDREFRESH に設定します(推奨)
    • ProjectId:Google Cloud のプロジェクト ID またはプロジェクト番号(クエリに必須)

    必須の OAuth スコープ

    Google Cloud Translation API プロファイルでは、以下の OAuth スコープが必要です:

    • https://www.googleapis.com/auth/cloud-translation - 翻訳、データセット、用語集、適応型 MT を含む Cloud Translation API リソースへのフルアクセス

    When you configure the connection, you may also want to set the Max Rows connection property. This will limit the number of rows returned, which is especially helpful for improving performance when designing reports and visualizations.

  4. Set the folder and server URL in your project properties. If you are publishing to SharePoint, the values for all properties must be fully qualified URLs. For example:
    • Report Server: http://MyServerName/ReportServer
    • SharePoint: http://MyServerName/MySite/MySubsite
  5. Right-click the shared data source and click Deploy.

レポートサーバー

レポートサーバーのネイティブモードのインストールでは、Report Manager を使って共有データソースを作成できます。レポートサーバーでデータソースを管理する権限が必要です。

  1. From the Home page in Report Manager, click New Data Source. The New Data Source page is displayed.
  2. Enter a name for the data source and in the Data Source Type menu, select CData API Report.
  3. In the Connection String box, enter the connection string to connect to Google Translate. A typical connection string is below:
     Profile=C:\profiles\GoogleTranslate.apip;AuthScheme=OAuth;InitiateOAuth=GETANDREFRESH;OAuthClientId=your_client_id;OAuthClientSecret=your_client_secret;CallbackUrl=your_callback_url;
     

    認証

    Google Cloud Translation API では、翻訳サービス、データセット、用語集、適応型 MT リソースへの安全なアクセスを確保するために、OAuth 2.0 認証が必要です。この認証方式により、Google Cloud プロジェクトに安全に接続し、適切な認可のもとで翻訳リソースを管理できます。

    OAuth 2.0 のセットアップと設定

    ステップ 1:Google Cloud プロジェクトの作成と API の有効化

    OAuth 認証をセットアップするには、以下のステップで進めます:

    1. Google Cloud Console にアクセスします
    2. 新しいプロジェクトを作成するか、既存のプロジェクトを選択します
    3. Project ID を控えておきます(すべての API 呼び出しで必要です)
    4. 「APIs & Services」 > 「Library」に移動します
    5. 「Cloud Translation API」を検索して有効化します
    6. 「APIs & Services」 > 「Credentials」に移動します
    7. 「Create Credentials」をクリックし、「OAuth Client ID」を選択します
    8. プロンプトが表示されたら OAuth 同意画面を設定します
    9. 用途に応じて「Desktop application」または「Web application」を選択します
    10. 承認済みリダイレクト URI(CallbackURL)を設定します
    11. 接続で使用する Client ID と Client Secret をコピーします

    必須の接続プロパティ

    • AuthScheme:OAuth に設定します(必須)
    • OAuthClientId:Google Cloud Console の Client ID(必須)
    • OAuthClientSecret:Google Cloud Console の Client Secret(必須)
    • CallbackURL:OAuth アプリケーションで指定したリダイレクト URI(必須)
    • InitiateOAuth:トークンを自動管理するには GETANDREFRESH に設定します(推奨)
    • ProjectId:Google Cloud のプロジェクト ID またはプロジェクト番号(クエリに必須)

    必須の OAuth スコープ

    Google Cloud Translation API プロファイルでは、以下の OAuth スコープが必要です:

    • https://www.googleapis.com/auth/cloud-translation - 翻訳、データセット、用語集、適応型 MT を含む Cloud Translation API リソースへのフルアクセス

SharePoint

SharePoint サイトで共有データソースを作成する方法は、次のとおりです。レポートサーバーcontent タイプをライブラリに追加していない場合は、追加しておく必要があります:

  1. SharePoint にログインし、.rsds ファイルを保存したいライブラリを開きます。
  2. [Library Tools]タブで[Settings]リボングループから[Library Settings]をクリックします。
  3. [General Settings]セクションで[Advanced Settings] をクリックします。
  4. [Content Types]セクションで[Yes]を選択し、cntent タイプの管理を許可します。[Content Types]セクションは[Library Settings]ページに追加されます。
  5. 既存のサイトcontent タイプから[Add]をクリックします。
  6. [Available Site Content Types]リストから[レポートデータソース]を選択し、[Add]をクリックします。

これで、共有データソースを作成できます。Google Translate への接続情報を含む.rsds ファイルを作成します。

  1. Log into SharePoint and open the library where you want to save the .rsds file.
  2. On the ribbon click Documents -> New Document -> Report Data Source.
  3. Enter a name for the data source.
  4. In the Data Source Type menu, select CData API Report.
  5. In the Connection String box, enter the connection string to connect to Google Translate. A typical connection string is below:
    Profile=C:\profiles\GoogleTranslate.apip;AuthScheme=OAuth;InitiateOAuth=GETANDREFRESH;OAuthClientId=your_client_id;OAuthClientSecret=your_client_secret;CallbackUrl=your_callback_url;
    

    認証

    Google Cloud Translation API では、翻訳サービス、データセット、用語集、適応型 MT リソースへの安全なアクセスを確保するために、OAuth 2.0 認証が必要です。この認証方式により、Google Cloud プロジェクトに安全に接続し、適切な認可のもとで翻訳リソースを管理できます。

    OAuth 2.0 のセットアップと設定

    ステップ 1:Google Cloud プロジェクトの作成と API の有効化

    OAuth 認証をセットアップするには、以下のステップで進めます:

    1. Google Cloud Console にアクセスします
    2. 新しいプロジェクトを作成するか、既存のプロジェクトを選択します
    3. Project ID を控えておきます(すべての API 呼び出しで必要です)
    4. 「APIs & Services」 > 「Library」に移動します
    5. 「Cloud Translation API」を検索して有効化します
    6. 「APIs & Services」 > 「Credentials」に移動します
    7. 「Create Credentials」をクリックし、「OAuth Client ID」を選択します
    8. プロンプトが表示されたら OAuth 同意画面を設定します
    9. 用途に応じて「Desktop application」または「Web application」を選択します
    10. 承認済みリダイレクト URI(CallbackURL)を設定します
    11. 接続で使用する Client ID と Client Secret をコピーします

    必須の接続プロパティ

    • AuthScheme:OAuth に設定します(必須)
    • OAuthClientId:Google Cloud Console の Client ID(必須)
    • OAuthClientSecret:Google Cloud Console の Client Secret(必須)
    • CallbackURL:OAuth アプリケーションで指定したリダイレクト URI(必須)
    • InitiateOAuth:トークンを自動管理するには GETANDREFRESH に設定します(推奨)
    • ProjectId:Google Cloud のプロジェクト ID またはプロジェクト番号(クエリに必須)

    必須の OAuth スコープ

    Google Cloud Translation API プロファイルでは、以下の OAuth スコープが必要です:

    • https://www.googleapis.com/auth/cloud-translation - 翻訳、データセット、用語集、適応型 MT を含む Cloud Translation API リソースへのフルアクセス

はじめる準備はできましたか?

API Driver で Google Translate のライブデータに接続

Google Translate に接続