JDBC Driver for Azure Data Lake Storage

Build 21.0.8137

Establishing a Connection

Creating a JDBC Data Source

You can create a JDBC data source to connect from your Java application. Creating a JDBC data source based on the CData JDBC Driver for Azure Data Lake Storage consists of three basic steps:

  • Add the driver JAR file to the classpath. The JAR file is located in the lib subfolder of the installation directory. Note that the .lic file must be located in the same folder as the JAR file.
  • Provide the driver class. For example:
    cdata.jdbc.adls.ADLSDriver
  • Provide the JDBC URL. For example:
    jdbc:adls:Schema=ADLSGen2;Account=MyStorageAccount;FileSystem=MyBlobContainer;AccessKey=myAccessKey;
    
    or
    
    jdbc:cdata:adls:Schema=ADLSGen2;Account=MyStorageAccount;FileSystem=MyBlobContainer;AccessKey=myAccessKey;

    The second format above can be used whenever there is a conflict in your application between drivers using the same URL format to ensure you are using the CData driver. The URL must start with either "jdbc:adls:" or "jdbc:cdata:adls:" and can include any of the connection properties in name-value pairs separated with semicolons.

Connecting to Azure DataLakeStorage Gen 1

To connect to a Gen 1 DataLakeStorage account, you should first set the following properties:

  • Schema: Set this to ADLSGen1.
  • Account: Set this to the name of the account.
  • AzureTenant: Set this to the tenant Id. See the property for more information on how to acquire this.
  • Directory: (Optional) 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 Azure DataLakeStorage Gen 1

Gen 1 supports the following authentication methods: Azure Active Directory OAuth (AzureAD) and Managed Service Identity (AzureMSI).

Authenticating using Azure AD

Azure AD is a connection type that goes through OAuth. Set your AuthScheme to AzureAD and see Using OAuth Authentication for an authentication guide.

Authenticating using Azure Service Principal

Azure Service Principal is a connection type that goes through OAuth. Set your AuthScheme to AzureServicePrincipal and see Using Azure Service Principal Authentication for an authentication guide.

Authenticating using MSI Authentication

If you are running Azure Data Lake Storage on an Azure VM, you can leverage Managed Service Identity (MSI) credentials to connect:

  • AuthScheme: Set this to AzureMSI.

The MSI credentials will then be automatically obtained for authentication.

Connecting to Azure DataLakeStorage Gen 2

To connect to a Gen 2 DataLakeStorage account, you should first set the following properties:

  • Schema: Set this to ADLSGen2.
  • Account: Set this to the name of the storage account.
  • FileSystem: Set this to the file system name which will be used for this account. For example, the name of an Azure Blob Container
  • Directory: (Optional) 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 Azure DataLakeStorage Gen 2

Gen 2 supports the following authentication methods: using an AccessKey, using a Shared Access Signature, Azure Active Directory OAuth (AzureAD), Managed Service Identity (AzureMSI).

Authenticating using an Access Key

To connect using a Shared Access Signature set the AccessKey property and the AuthScheme to AccessKey.

You can obtain an access key for the ADLS Gen2 storage account using the Azure portal:

  1. Go to your ADLS Gen2 Storage Account in the Azure portal.
  2. Under Settings, select Access keys.
  3. Copy the value for one of the available access keys to the AccessKey connection property.

Authenticating using a Shared Access Signature (SAS)

To connect using a Shared Access Signature set the SharedAccessSignature property to a valid signature of a resource to connect to and the AuthScheme to SAS. The SharedAccessSignature may be generated with a tool such as Azure Storage Explorer.

Authenticating using Azure AD

Azure AD is a connection type that goes through OAuth. Set your AuthScheme to AzureAD and see Using OAuth Authentication for an authentication guide.

Authenticating using Azure Service Principal

Azure Service Principal is a connection type that goes through OAuth. Set your AuthScheme to AzureServicePrincipal and see Using Azure Service Principal Authentication for an authentication guide.

Authenticating using MSI Authentication

If you are running Azure Data Lake Storage on an Azure VM, you can leverage Managed Service Identity (MSI) credentials to connect:

  • AuthScheme: Set this to AzureMSI.

The MSI credentials will then be automatically obtained for authentication.

Copyright (c) 2022 CData Software, Inc. - All rights reserved.
Build 21.0.8137