This project demonstrates how to connect to Databricks from .NET applications using two different approaches:
- ODBC Connection - Using the Simba Spark ODBC Driver
- REST API Connection - Using Databricks SQL Statement Execution API
dotnet_databricks/
├── odbc/ # ODBC connection example
│ ├── OdbcDatabricks.cs # Main ODBC implementation
│ ├── README.md # Detailed ODBC setup instructions
│ └── dotnet_databricks.csproj
├── restapi/ # REST API connection example
│ ├── RestapiDatabricks.cs # Main REST API implementation
│ ├── README.md # Detailed REST API setup instructions
│ └── dotnet_databricks.csproj
└── README.md # This file
- .NET 9.0 SDK
- A Databricks workspace
- Databricks personal access token
- For ODBC: Simba Spark ODBC Driver (see odbc/README.md for installation instructions)
Both examples execute a sample query against the Databricks samples.tpch.orders table (available in most Databricks workspaces) and retrieve the results:
- REST API: Prints results to console
- ODBC: Writes results to
query_results.txtfile
- ODBC Setup Guide - Detailed instructions for ODBC driver installation and configuration
- REST API Setup Guide - Detailed instructions for REST API setup
- Databricks ODBC Driver Documentation
- Databricks SQL Statement Execution API
- Use environment variables or secure configuration management in production
- Rotate your Databricks personal access tokens regularly
This project is provided as example code for educational purposes.