This page explains how to connect MIStudio to a Databricks SQL Warehouse using JDBC.
The connection can be used in the MIStudio Logic Editor to read data from Databricks, execute SQL statements, write database data, and send database results to other application components.
A typical MIStudio-to-Databricks connection requires:
After the connection is configured, database components such as DatabaseRawLookup and DatabaseRawWrite can execute SQL against Databricks.
Sign in to your Databricks workspace.
Open the SQL Warehouse that MIStudio should use.
In Databricks:
Keep these values available while configuring MIStudio.
Typical connection information includes:
| Server Hostname | YOUR-SERVER-HOSTNAME |
| Port | 443 |
| HTTP Path | /sql/1.0/warehouses/YOUR-WAREHOUSE-ID |
Download the Databricks JDBC Driver from Maven Central:
Databricks JDBC Driver on Maven Central
Databricks publishes the JDBC driver under:
com.databricks:databricks-jdbc
Select the desired driver version and download the JAR file.
The downloaded file follows this naming pattern:
databricks-jdbc-<version>.jar
For example:
databricks-jdbc-3.4.2.jar
The JDBC driver class used by MIStudio is:
com.databricks.client.jdbc.Driver
The Databricks JDBC driver can be added directly to the MIStudio project.
In the MIStudio project tree:
The driver file follows this naming pattern:
databricks-jdbc-<version>.jar
Databricks supports multiple JDBC authentication methods.
For a simple connection test, a Databricks Personal Access Token (PAT) can be used.
For PAT authentication:
| Setting | Value |
|---|---|
| User Name | `token` |
| Password | Your Databricks Personal Access Token |
| AuthMech | `3` |
Treat the token as a password.
A Personal Access Token can be useful for testing and development. Production environments may require a different authentication method based on your organization's Databricks security requirements.
Open the MIStudio project and application that will use Databricks.
Open the MIStudio Logic Editor and add a:
DatabricksConnectionManager
Configure the connection manager using the connection information from your Databricks SQL Warehouse.
Enter the appropriate values for:
For the JDBC Driver Class, use:
com.databricks.client.jdbc.Driver
The Server Hostname should be entered without the protocol.
For example, enter:
YOUR-SERVER-HOSTNAME
Do not enter:
Copy the HTTP Path from the Databricks SQL Warehouse Connection Details.
The HTTP Path should include the leading slash, for example:
/sql/1.0/warehouses/YOUR-WAREHOUSE-ID
For PAT-based authentication, enter the following connection properties.
Enter each property on its own line:
AuthMech=3 transportMode=http ssl=1
The MIStudio User Name field should contain:
token
The Password field should contain the Databricks Personal Access Token.
MIStudio must be running the application logic for database components to execute.
Before testing the Databricks connection:
The connection manager reference will normally point to the DatabricksConnectionManager in the application.
For example:
/Main/DatabricksConnectionManager
Start with a simple query before attempting a larger database operation.
In DatabaseRawLookup, enter:
SELECT 1
Trigger the DatabaseRawLookup while MIStudio is in Simulating mode.
If the connection is successful, the query should return:
1
You can also check the Databricks SQL Warehouse Query History to confirm that the query was received and executed.
After confirming the connection, determine which Databricks catalog and schema MIStudio is using.
Use DatabaseRawLookup with:
SELECT current_catalog()
Then check the schema:
SELECT current_schema()
These values identify the current location used by unqualified SQL queries.
Databricks objects can also be referenced using fully qualified names:
catalog.schema.table
For example:
my_catalog.my_schema.my_table
Using fully qualified table names can help prevent queries from running against the wrong catalog or schema.
Use DatabaseRawLookup for SQL statements that return data.
Common examples include:
Example:
SELECT * FROM my_catalog.my_schema.my_table
Use DatabaseRawWrite for SQL statements that create or modify database content.
Common examples include:
For example:
CREATE TABLE IF NOT EXISTS my_catalog.my_schema.mistudio_test ( id INT, message STRING, created_at TIMESTAMP )
After creating a test table, insert a value using DatabaseRawWrite.
For example:
INSERT INTO my_catalog.my_schema.mistudio_test (id, message, created_at) VALUES (1, 'Hello from MIStudio', CURRENT_TIMESTAMP())
Then use DatabaseRawLookup to read the value back:
SELECT message FROM my_catalog.my_schema.mistudio_test WHERE id = 1
A successful readback confirms that MIStudio can:
Use the MIStudio database component that matches the SQL operation.
| SQL Operation | MIStudio Component |
|---|---|
| `SELECT` | DatabaseRawLookup |
| Metadata query | DatabaseRawLookup |
| Catalog or schema query | DatabaseRawLookup |
| `CREATE TABLE` | DatabaseRawWrite |
| `INSERT` | DatabaseRawWrite |
| `UPDATE` | DatabaseRawWrite |
| `DELETE` | DatabaseRawWrite |
Databricks SQL Warehouse Query History can be useful when testing the connection.
Query History can help confirm that:
If a query appears to execute in MIStudio but the expected result is not visible, check Databricks Query History as part of troubleshooting.
Confirm that MIStudio is in Simulating mode.
Also confirm that the database component is configured to use the intended DatabricksConnectionManager.
Confirm that:
com.databricks.client.jdbc.Driver
Confirm:
For PAT authentication, confirm that the User Name is:
token
and that the Password field contains the user's Databricks Personal Access Token.
Confirm that the correct MIStudio database component is being used.
Use:
Confirm the current catalog and schema:
SELECT current_catalog()
SELECT current_schema()
If necessary, use the complete table name:
catalog.schema.table
Check that:
Then check the Databricks SQL Warehouse Query History.
Database credentials and Databricks access tokens should be handled securely.
Do not include credentials in:
Use the authentication method required by your organization for production systems.
Databricks SQL Warehouse
|
| Server Hostname
| Port
| HTTP Path
| Authentication
v
Databricks JDBC Driver
|
v
MIStudio Project Drivers
|
v
DatabricksConnectionManager
|
+--> DatabaseRawLookup
| |
| +--> SELECT / Read Data
|
+--> DatabaseRawWrite
|
+--> CREATE / INSERT / UPDATE / DELETE