JDBC Driver for Azure Table Storage

Build 22.0.8462

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 Table 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.azuretables.AzureTablesDriver
  • Provide the JDBC URL. For example:
    jdbc:azuretables:AccessKey=myAccessKey;Account=myAccountName;
    
    or
    
    jdbc:cdata:azuretables:AccessKey=myAccessKey;Account=myAccountName;

    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:azuretables:" or "jdbc:cdata:azuretables:" and can include any of the connection properties in name-value pairs separated with semicolons.

Connecting to Azure Table Storage APIs

The driver will connect to the Azure Table Storage account specified by Account. By default, connections to the Azure Table Storage are secured via SSL, though this can be controlled through UseSSL. The authentication method to the Azure Table Storage is determined by the AuthScheme property.

Authenticating to Azure Table Storage

The following mechanisms may be used to authenticate.

Access Key

Set Account to the storage account name and set the AccessKey of the storage account to connect. Follow the steps below to obtain these values:

If using Storage as the Backend (default):

  1. Log into the Azure portal and select Storage Accounts in the services menu on the left.
  2. If you currently do not have any storage accounts, create one by clicking the Add button.
  3. Click the link for the storage account you want to use and select Access Keys under Settings. The Access Keys window contains the storage account name and key (you can use either key1 or key2 to connect) that you will need to use in the driver. These properties map to the Account and AccessKey driver connection properties respectively.

If using CosmosDB as the Backend:

  1. Log into the Azure portal and select Cosmos DB in the services menu on the left.
  2. Click the link for the Cosmos DB account you want to use and select Connection String under Settings. The Connection String window contains the Cosmos DB account name and primary key that you will need to use in the driver. These properties map to the Account and AccessKey driver connection properties respectively.

Shared Access Signature

Set Account to the storage account name and set the SharedAccessSignature to a valid signature of a resource to connect to. The SharedAccessSignature may be generated with a tool such as Azure Storage Explorer.

Typically when SharedAccessSignature is used, the specific table to work with must also be specified via the Tables connection property. If no table is specified, a table listing will be attemped, but may fail due to a lack of permissions.

Copyright (c) 2023 CData Software, Inc. - All rights reserved.
Build 22.0.8462