Hi,
I have successfully established an ODBC connection with Databricks to retrieve data from the Unity Catalog in a local C# application using the Simba Spark ODBC Driver, and it is working as expected.
I now need to integrate this functionality into an existing .NET C# application hosted on an Azure App Service (Linux). However, I have not been able to locate any documentation or resources specific to implementing the ODBC connector in this environment.
Could you kindly provide any relevant documentation, guidelines, or suggestions on how to achieve this integration? Your assistance would be greatly appreciated.
using System;
using System.Data.Odbc;
class Program
{
static void Main()
{
// Connection details
// ODBC connection string
//string connectionString = $"Driver={{Simba Spark ODBC Driver}};" +
// $"Host={serverHostname};" +
// $"HTTPPath={httpPath};" +
// $"AuthMech=3;" +
// $"UID=token;" +
// $"PWD={accessToken};";
try
{
// Connect to the database
using (OdbcConnection connection = new OdbcConnection(connectionString))
{
connection.Open();
Console.WriteLine("Connected to Databricks!");
// Query to execute
string query = "SELECT * FROM Table LIMIT 5";
using (OdbcCommand command = new OdbcCommand(query, connection))
{
using (OdbcDataReader reader = command.ExecuteReader())
{
Console.WriteLine("Query Results:");
while (reader.Read())
{
Console.WriteLine(reader["column"]);
}
}
}
}
}
catch (Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
}
}
}