Legacy Databricks JDBC Driver
This page describes authentication settings for legacy Databricks JDBC Driver versions 2.6.22 and below. For version 3 and above, see Databricks JDBC Driver.
Use the most secure authentication flow available. The authentication methods on this page carry risks not present in other flows. Only use these methods when more secure options, such as managed identities, aren't viable.
Requirements
The legacy driver requires the transportMode and SSL properties. Set these to http and 1, respectively.
For <server-hostname> and <http-path> values, see the procedures at the end of this page. For a complete Java example, see Authentication settings for the Databricks JDBC Driver (Simba).
Personal access token authentication
Connection URL
jdbc:spark://<server-hostname>:443;httpPath=<http-path>;transportMode=http;SSL=1;UID=token;PWD=<personal-access-token>
Replace <personal-access-token> with your Databricks personal access token.
Java
// ...
String url = "jdbc:spark://<server-hostname>:443;httpPath=<http-path>;transportMode=http;SSL=1";
Properties p = new java.util.Properties();
p.put("UID", "token");
p.put("PWD", "<personal-access-token>");
// ...
DriverManager.getConnection(url, p);
// ...
To get the connection details for a Databricks cluster:
- Log in to your Databricks workspace.
- In the sidebar, click Compute.
- In the list of available clusters, click the target cluster's name.
- On the Configuration tab, expand Advanced options.
- Click the JDBC/ODBC tab.
- Copy the connection details that you need, such as Server Hostname, Port, and HTTP Path.
To get the connection details for a Databricks SQL warehouse, do the following:
- Log in to your Databricks workspace.
- In the sidebar, click SQL > SQL Warehouses.
- In the list of available warehouses, click the target warehouse's name.
- On the Connection Details tab, copy the connection details that you need, such as Server hostname, Port, and HTTP path.
To use the driver with a Databricks cluster, there are two permissions that the calling user or service principal needs when connecting to or restarting the cluster:
- CAN ATTACH TO permission to connect to the running cluster.
- CAN RESTART permission to automatically trigger the cluster to start if its state is terminated when connecting.
To use the driver with a Databricks SQL warehouse, the calling user or service principal needs CAN USE permission. The Databricks SQL warehouse automatically starts if it was stopped.
Databricks SQL warehouses are recommended when using Microsoft Power BI in DirectQuery mode.