CData JDBC Driver for ADLS は、JDBC をサポートするIDE にリアルタイムAzure Data Lake Storage データへの仮想DB 連携を実現します。JDBC 標準では、ビルトインのデータアクセスウィザードや、迅速な開発をサポートするその他のツールを使用できます。この記事では、NetBeans でAzure Data Lake Storage に接続する方法を説明します。接続を作成してロード していきます。
NetBeans にAzure Data Lake Storage のJDBC データソースを作成
JDBC データソースを作成するには、[Service]ウィンドウの[Database]ノードを展開し、[Drivers]ノードを右クリックして[New Driver]を選択します。[New Driver]ウィザードが表示されたら、以下の情報を入力します:
- Driver File(s):[Add]をクリックして、ファイルエクスプローラダイアログが表示されたらcdata.jdbc.adls.jar ファイルを選択。ドライバーのJAR はインストールディレクトリの[lib]サブフォルダ内にあります。
- Driver Class:[Find]をクリックしてJAR 内のドライバークラスを検索し、cdata.jdbc.adls.ADLSDriver をメニューから選択。
- Name:ドライバーの名前を入力。
接続パラメータを定義
下記の手順に従って、必要な接続プロパティを定義します:
[Service]ウィンドウで、[Database]ノードを右クリックし[New Connection]をクリックします。
[New Connection]ウィザードで次の接続プロパティを入力します:
- Driver Name:CData JDBC Driver for ADLS を選択。
- User Name:ユーザーネームを入力。JDBC URL でも定義できます。
- Password:パスワードを入力。JDBC URL でも定義できます。
JDBC URL: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.
以下は一般的なJDBC URL です:
jdbc:adls:Schema=ADLSGen2;Account=myAccount;FileSystem=myFileSystem;AccessKey=myAccessKey;
リアルタイムAzure Data Lake Storage データをクエリ
Azure Data Lake Storage に接続するには、[Database]ノードにある接続を右クリックし[Connect]をクリックします。接続が確立されたら、展開してスキーマ情報を見ることができます。
[Data Views]ウィンドウにテーブルをロードするには、テーブルを右クリックしてから[View Data]をクリックします。。