Configure the External Database Connector for Databricks
Introduction
The External Database connector allows you to connect to databases and select data to use in your app. You can use it to directly test connections and queries during configuration in Studio Pro at design time. For Mendix apps that use Databricks as their database, the External Database connector is the recommended integration option for Mendix 10.20.0 and up.
This how-to describes the steps required to enable your app to use the External Database connector with Databricks.
Prerequisites
For some general information on how to use bring your own JDBC driver with the external database connector, read External Database Connector: Configure for Any Database.
Configuring the Connection Between Your Mendix App and Databricks
To connect your Mendix application to Databricks with the External Database connector, follow these steps:
-
Install the External Database connector version 5.1.1 or higher.
-
Ensure that you have the required Databricks JDBC Driver by choosing one of the following options:
- To have the dependency downloaded automatically on running your project, add a Java Dependency in the Settings of you module and provide the following information:
- Group ID - set to com.databricks
- Artifact ID - set to databricks-jdbc
- Version - set to 2.7.1
- To install the dependency manually, download version 2.7.1 of the JDBC driver that Databricks provides and put the .jar file into the userlib of your Mendix project.
- To have the dependency downloaded automatically on running your project, add a Java Dependency in the Settings of you module and provide the following information:
-
Run you Mendix project and run the Connect to Database wizard, selecting Other as the database type.
-
Provide a name for the database connection document.
-
Enter the following connection details:
- User name - set to token
- Password - set to the personal access token (PAT) that you can generate through the user settings in Databricks:
-
In your Databricks account find the JDBC URL related to the SQL warehouse or cluster which you are using.
-
Copy the URL into the JDBC URL field and add UID=token;PWD=
PAT
, wherePAT
is your actual PAT. -
Click Test Connection to verify the connection details, and then click Save.
Your Mendix app now connects to Databricks with the provided connection details. When the connection is successful, you can see your Databricks tables in your Mendix app.

You can now configure the queries that you need to run on your Databricks database. The following section of this document provides an example of a common query. For general information about creating queries, see External Database Connector: Querying a Database and External Database Connector: Using Query Response.
Configuring a Basic Query
This section shows a basic example of how to use the database connector to execute a query on your Databricks data.
Creating Data in your Databricks Workspace
If you do not have any test customer data in your Databricks workspace, you can create it by running the following SQL command in your workspace’s SQL Editor:
CREATE TABLE customerData (
name varchar(64),
address varchar(64),
postal_code varchar(6),
gender varchar(64)
);
INSERT INTO customerData (name, address, postal_code, gender) VALUES
('Henk de Vries', 'Klaprooslaan 5, Bloemenstad', '1234AB', 'Male'),
('Sanne Verbeek', 'Molendam 8, Waterveen', '2345CD', 'Female'),
('Jan-Willem Bos', 'Zonstraat 22, Zomerhoven', '3456EF', 'Male'),
('Marieke de Groot', 'Windmolenweg 33, Korenveld', '4567GH', 'Female'),
('Bert van Dijk', 'Vlinderplein 15, Lenteveen', '5678JK', 'Male'),
('Lotte van Dam', 'Regenboogpad 10, Kleurenburg', '6789LM', 'Female'),
('Koen Smits', 'Eikenlaan 2, Bosrijk', '7890NO', 'Male'),
('Emma Visser', 'Druppelweg 45, Regenstad', '8901QP', 'Female'),
('Thomas Mulder', 'Sterrenhof 7, Hemelrijk', '9012RS', 'Male'),
('Sophie Jansen', 'Kersenstraat 12, Fruitdorp', '0123TU', 'Female');

Querying the Data
After you have created a table with some entries, you can now be query from your Mendix application.
-
In your Mendix app, in the App Explorer, find and open the external connection document that you created with the Connect to Database wizard.
-
In the Name field, enter a name for your query, for example, CustomerData_Get.
-
Enter the following SQL Query:
SELECT * FROM customerData
-
Click Run Query.
-
Verify that the results are correct, and then generate the required entity to collect the data in your Mendix application. For more information, see External Database Connector: Creating an Entity from the Response.
-
Create a microflow that will run the query by doing the following steps:
- In the App Explorer, right-click on the name of your module, and then click Add microflow.
- Enter a name for your microflow, for example, ACT_Customerdata_Get, and then click OK.
- In your Toolbox, find the Query External Database activity and drag it onto the work area of your microflow.
- Position the Query External Database activity between the start and end event of your microflow.
- Double-click the Query External Database microflow activity to configure the required parameters.
- In the Database section, select your Databricks database.
- In the Query list, select the query name that you entered in step 2.
- In the Output section, provide the following values:
- Return type - List of {your module name}.customerdata
- Use return value - set to Yes
- List name - enter Customerdata_list
- Click OK.
-
Link the microflow to a microflow button and use the Debugger to test if the objects are properly returned.