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.