CData JDBC Driver for ADLS は企業全体のAzure Data Lake Storage へのデータ連携を可能にします。この記事では、JasperReports server にドライバーを配布してレポーティングドメイン、ビルディングブロックを作成し、ad hoc 帳票を作成する方法を説明します。
Azure Data Lake Storage ドライバーのJAR を配布
下記の手順に従って、ドライバーのJAR をJasperReports server に配置します。標準的なプロセスに従って、JNDI データソースをTomcat またはJBoss に配布できます。以下の説明にはAzure Data Lake Storage およびJasperReports Server にバンドルされたTomcat server の詳細が含まれます。
- インストールディレクトリの[lib]サブフォルダ内のドライバーJAR およびlic ファイルを、apache-tomcat フォルダの[lib]サブフォルダにコピーします。
-
以下のリソースエントリーをjasperserver-pro Web アプリケーションのcontext.xml に追加します。これはアプリケーションの[META-INF]サブフォルダに配置されています。必要な接続プロパティをJDBC URL に指定します。
Authenticating to a Gen 1 DataLakeStore Account
Gen 1 uses OAuth 2.0 in Azure AD for authentication.
For this, an Active Directory web application is required. You can create one as follows:
- Sign in to your Azure Account through the
[.
]- Select "Azure Active Directory".
- Select "App registrations".
- Select "New application registration".
- Provide a name and URL for the application. Select Web app for the type of application you want to create.
- Select "Required permissions" and change the required permissions for this app. At a minimum, "Azure Data Lake" and "Windows Azure Service Management API" are required.
- Select "Key" and generate a new key. Add a description, a duration, and take note of the generated key. You won't be able to see it again.
To authenticate against a Gen 1 DataLakeStore account, the following properties are required:
- Schema: Set this to ADLSGen1.
- Account: Set this to the name of the account.
- OAuthClientId: Set this to the application Id of the app you created.
- OAuthClientSecret: Set this to the key generated for the app you created.
- TenantId: Set this to the tenant Id. See the property for more information on how to acquire this.
- Directory: Set this to the path which will be used to store the replicated file. If not specified, the root directory will be used.
Authenticating to a Gen 2 DataLakeStore Account
To authenticate against a Gen 2 DataLakeStore account, the following properties are required:
- Schema: Set this to ADLSGen2.
- Account: Set this to the name of the account.
- FileSystem: Set this to the file system which will be used for this account.
- AccessKey: Set this to the access key which will be used to authenticate the calls to the API. See the property for more information on how to acquire this.
- Directory: Set this to the path which will be used to store the replicated file. If not specified, the root directory will be used.
<Resource name="jdbc/adls" auth="Container" type="javax.sql.DataSource" driverClassName="cdata.jdbc.adls.ADLSDriver" url="jdbc:adls:Schema=ADLSGen2;Account=myAccount;FileSystem=myFileSystem;AccessKey=myAccessKey;" maxActive="20" maxIdle="10" maxWait="-1" factory="com.jaspersoft.jasperserver.tomcat.jndi.JSBasicDataSourceFactory"/>
-
jasperserver-pro Web アプリケーションのweb.xml に以下の参照を追加します。これはアプリケーションの[WEB-INF]サブフォルダに配置されています。
Azure Data Lake Storage data JSP
jdbc/adls
javax.sql.DataSource
Container
-
サーバーを再起動します。
Azure Data Lake Storage JDBC データソースの作成
ドライバーを配布したら、JNDI 接続を作成してバンドルされたあらゆるドライバーと同じように接続できます。
- JasperReports Server にログインして[Create]>[Data Source]をクリックします。
- [Type]メニューで[JNDI Data Source]を選択します。
- [Service Name]ボックスにAzure Data Lake Storage に定義したJDNI ルックアップを入力します。例では、ルックアップは jdbc/adls です。
ドメイン の作成
データのドメインはJaspersoft のメタデータレイヤです。アドホックな分析および帳票で使うことができます。
- [Create]>[Domain]をクリックし、ドメインにID を入力します。
- [Data Source]セクションで[ブラウズ]をクリックし、作成したAzure Data Lake Storage データソースを選択します。
- [Domain Design]セクションで[Create with Database Designer]をクリックします。[Select Database Schema]ダイアログが表示されます。
- Azure Data Lake Storage データソースを選択します。
- [Tables]タブの[Data Source]ペインでテーブルを選択し、矢印をクリックして[Selected Tables]に追加します。
- [Display]タブの[Resources]ペインでAzure Data Lake Storage エンティティを選択し、矢印をクリックしてリソースを[Sets and Items]ペインに追加します。
ドメインにView Based を作成
ドメインを使ってAzure Data Lake Storage のビジネスビューを作成したら、データに関連あるサブセットを表示するビューを作成します。下記の手順に従って、[Ad Hoc Editor]の[Ad Hoc view]にビューを作成します。
- [Create]>[Ad Hoc View]をクリックします。
-
ダイアログが表示されたら、作成したAzure Data Lake Storage ドメインを選択します。
-
[Choose Data]ページで、ビューで使いたいカラムを選択します。[Select Fields]セクションでは、フィルターおよび入力用のプロンプトユーザーを作成できます。[Display]セクションでは、フィールドおよびフィールド名の並び順を変更できます。
-
ウィザードを完了したら、ビューの種類を選択しビューにカラムを追加できます。JasperSoft はドライバーのメタデータを使って、利用可能なdimensions およびmeasures をデータの種類に基づいて検出します。 [Columns] および[Rows]ボックスにdimensions およびmeasures をドラッグします。例えば、チャートを作成するには[Columns]ボックスに[excol#1]を、[Rows]ボックスに[excol#2]をドラッグします。
- ビューを保存します。
帳票の作成
これでドメインから帳票を作成できます: