# Databricks connection troubleshooting

For issues with connecting to Databricks, here are some suggested troubleshooting steps for self-hosted instances.

## Retrieving driver logs

If a connection test fails, and you have ruled out other issues such as network access and user permissions, another place to look is the driver logs.

You can send these to Tonic.ai for the support team to use to identify the problem.

To retrieve the driver logs:

1. Set the [environment setting](https://docs.tonic.ai/app/admin/environment-variables-setting) `TONIC_LOG_TRACES` to `true`.\
   \
   Changes to this setting require a restart of Structural.
2. Set the environment setting `TONIC_DATABRICKS_ODBC_LOG_LEVEL` to `6`.\
   \
   You can configure this environment setting from the **Environment Settings** tab on **Structural Settings**.
3. In the workspace settings, test the data connection.
4. To retrieve the logs:
   1. Open a shell in the Tonic Structural web server container.
   2. Locate the driver logs in the following folder: `/var/log/simba`

After you retrieve the logs, set `TONIC_DATABRICKS_ODBC_LOG_LEVEL` back to `0`.

## Running an isql test command

If a connection test fails, and you suspect a networking issue, then you can use an isql test command to check whether the Structural container can connect to the Databricks host.

Before you do this, verify that there isn't a permissions issue.

To run the isql test command:

1. Open a shell in the Tonic web server container.
2. Get the host, HTTP path, and password (Personal Access Token) for the Databricks connection.
3. Run the following command:

{% code overflow="wrap" %}

```
# Test connection
isql -v -k "DRIVER={Simba Spark ODBC Driver};Host=<host>;HTTPPath=<http_path>;AuthMech=3;UID=token;PWD=<password>;Port=443;SSL=1;ThriftTransport=2;"
# Type "quit" to exit
```

{% endcode %}

If the command succeeds, then you can rule out networking issues related to the ability to access the Databricks host from the Structural container.

If the isql command is not successful, you next check for other network issues that could block the connection, such as issues with:

* HTTP path
* IP address allow lists
* NAT gateways
* Proxies
* DNS resolution


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tonic.ai/app/setting-up-your-database/databricks/databricks-connection-troubleshooting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
