Compute settings for the Databricks JDBC Driver
This article describes how to configure Databricks compute resource settings for the Databricks JDBC Driver.
The driver requires the following compute resource configuration settings:
Setting |
Description |
---|---|
|
The Databricks compute resource’s Server Hostname value. |
|
443 |
|
The Databricks compute resource’s HTTP Path value. |
|
1 |
|
The name of the default schema to use. |
|
The name of the default catalog to use. |
A JDBC connection URL that uses the preceding settings has the following format:
jdbc:databricks://<server-hostname>:443;httpPath=<http-path>[;<setting1>=<value1>;<setting2>=<value2>;<settingN>=<valueN>]
Java code that uses the preceding settings has the following format:
// ...
String url = "jdbc:databricks://<server-hostname>:443";
Properties p = new java.util.Properties();
p.put("httpPath", "<http-path>");
p.put("<setting1>", "<value1");
p.put("<setting2>", "<value2");
p.put("<settingN>", "<valueN");
// ...
Connection conn = DriverManager.getConnection(url, p);
// ...
For a complete Java code example that you can adapt as needed, see the beginning of Authentication settings for the Databricks JDBC Driver.
Replace
<setting>
and<value>
as needed for each of the target Databricks authentication settings and any special or advanced driver capability settings.To get the values for
<server-hostname>
and<http-path>
, see the following procedures.
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.
Note
Databricks SQL warehouses are recommended when using Microsoft Power BI in DirectQuery mode.