Connect to SQL Workbench/J

This article describes how to use SQL Workbench/J with Azure Databricks.

Note

This article covers SQL Workbench/J, which is neither provided nor supported by Databricks. To contact the provider, see use the SQL Workbench/J support forum in Google Groups..

Requirements

  • SQL Workbench/J.

  • The Databricks JDBC Driver. Download the Databricks JDBC Driver onto your local development machine, extracting the DatabricksJDBC42.jar file from the downloaded DatabricksJDBC42-<version>.zip file.

    Note

    This article was tested with macOS, SQL Workbench/J Build 130, Zulu OpenJDK 21.0.1, and Databricks JDBC Driver 2.6.36.

    For Azure Databricks authentication, if you are not using Azure Databricks personal access token authentication, you can skip generating a personal access token later in these requirements. For more information about available Azure Databricks authentication types, see Authentication settings for the Databricks JDBC Driver.

  • A cluster or SQL warehouse in your Azure Databricks workspace.

  • The connection details for your cluster or SQL warehouse, specifically the Server Hostname, Port, and HTTP Path values.

  • An Azure Databricks personal access token or a Microsoft Entra ID (formerly Azure Active Directory) token.. To create a personal access token, do the following:

    1. In your Azure Databricks workspace, click your Azure Databricks username in the top bar, and then select Settings from the drop down.
    2. Click Developer.
    3. Next to Access tokens, click Manage.
    4. Click Generate new token.
    5. (Optional) Enter a comment that helps you to identify this token in the future, and change the token’s default lifetime of 90 days. To create a token with no lifetime (not recommended), leave the Lifetime (days) box empty (blank).
    6. Click Generate.
    7. Copy the displayed token to a secure location, and then click Done.

    Note

    Be sure to save the copied token in a secure location. Do not share your copied token with others. If you lose the copied token, you cannot regenerate that exact same token. Instead, you must repeat this procedure to create a new token. If you lose the copied token, or you believe that the token has been compromised, Databricks strongly recommends that you immediately delete that token from your workspace by clicking the trash can (Revoke) icon next to the token on the Access tokens page.

    If you are not able to create or use tokens in your workspace, this might be because your workspace administrator has disabled tokens or has not given you permission to create or use tokens. See your workspace administrator or the following topics:

    Note

    As a security best practice, when you authenticate with automated tools, systems, scripts, and apps, Databricks recommends that you use personal access tokens belonging to service principals instead of workspace users. To create tokens for service principals, see Manage tokens for a service principal.

Steps to connect to Workbench/J

To connect to Workbench/J, do the following:

  1. Launch SQL Workbench/J.
  2. Select File > Connect window.
  3. In the Select Connection Profile dialog, click Manage Drivers.
    1. In the Name field, type Databricks.
    2. In the Library field, click the Select the JAR file(s) icon. Browse to the directory where you extracted the DatabricksJDBC42.jar file from the downloaded DatabricksJDBC42-<version>.zip file, and select the JAR file. Then click Choose.
    3. Verify that the Classname field is populated with com.databricks.client.jdbc.Driver.
    4. Click OK.
  4. Click the Create a new connection profile icon.
    1. Type a name for the profile.
    2. In the Driver field, select Databricks (com.databricks.client.jdbc.Driver).
    3. In the URL field, enter the JDBC URL for your Azure Databricks resource. For the URL field syntax for JDBC URLs, see Authentication settings for the Databricks JDBC Driver.
    4. Click Test.
    5. Click OK twice.

Additional resources