Skip to content

matlab/matlab-agentic-toolkit / skills-catalog/reporting-and-database-access/matlab-connect-databricks

matlab-connect-databricks

Verified

Connect MATLAB to Databricks via Spark (Databricks Connect) or JDBC (Database Toolbox). Use when setting up the MATLAB Interface for Databricks, configuring authentication (OauthU2M, OauthM2M, PAT), creating Spark sessions with getDatabricksSession(), reading Unity Catalog tables with server-side filtering, creating JDBC connections with databricks.JDBCConnection or StandaloneJDBCConnection, connecting to SQL Warehouses, selecting JDBC drivers (Simba/OSS), or writing data back to Databricks. Triggers on: Databricks Connect, Spark from MATLAB, getDatabricksSession, .databrickscfg, databricks.JDBCConnection, StandaloneJDBCConnection, SQLWarehouse, Databricks JDBC, Databricks cluster, large table server-side filtering.

FileKindSize
SKILL.mdskill md13.6 KB
manifest.yamlconfig450 B
references/authentication.mdmarkdown4.6 KB
references/driver-selection.mdmarkdown3.1 KB
references/standalone-jdbc.mdmarkdown3.4 KB

references/driver-selection.md

View on GitHub
# JDBC Driver Selection

## Supported Drivers

| Driver | Version Range | Java Requirement | Included in Package | Key Feature |
|--------|--------------|------------------|:-------------------:|-------------|
| Simba (non-OSS) | >= 2.7.3, < 3.0.0 | Java 8+ (MATLAB default) | Yes | Write optimization via `UseNativeQuery` |
| OSS | >= 3.0.3 | Java 11+ | No | Arrow-based data transfer for faster large reads |

## Auto-Selection Logic

When neither `useDriverType` nor `jarFilePath` is specified:

| Java Version | Simba Present | OSS Present | Driver Selected |
|:------------:|:------------:|:-----------:|:---------------:|
| > 8 | Yes | Yes | OSS |
| > 8 | Yes | No | Simba |
| 8 | Yes | Any | Simba (default) |

Explicit override:

```matlab
j = databricks.JDBCConnection(useDriverType="oss");   % Force OSS
j = databricks.JDBCConnection(useDriverType="simba"); % Force Simba
j = databricks.JDBCConnection(jarFilePath="path/to/specific.jar"); % Specific jar
```

## Simba Driver (Default)

Ships with the package at: `Software/MATLAB/lib/jar/Shaded-Databricks-JDBC-Driver-0.0.2.jar`

The driver is shaded (relocated dependencies) to avoid classpath conflicts. Using the unshaded driver from Databricks directly produces spurious logging.

### Write Optimization

`UseNativeQuery=1` and `EnableNativeParameterizedQuery=0` significantly improve `sqlwrite` performance. Enabled by default via `databricks.JDBCConnection` and `SQLWarehouse.connect()`.

```matlab
% Disable optimization (not recommended for writes)
j = databricks.JDBCConnection(useNativeQuery=false, enableNativeParameterizedQuery=true);
```

### Custom Build

To build from a newer Databricks driver:
1. Install Apache Maven and a JDK
2. From `Software/Java/JDBCDriver/`, run: `mvn clean package`
3. Output: `Software/MATLAB/lib/jar/Shaded-Databricks-JDBC-Driver-0.0.2.jar`

## OSS Driver

### Setup

Build using Maven from `Software/Java/JDBCDriver/`:
```
mvn clean package -f pomOSS.xml
```
Output: `Software/MATLAB/lib/jar/Databricks-JDBC-OSS-Driver-0.0.1.jar`

### Java Configuration

```matlab
jenv                          % Check current version
jenv("/usr/local/jre-11")     % Set Java 11+ (requires MATLAB restart)
jenv("factory")               % Reset to default
```

**Avoid Java 16** — requires JVM startup arguments in `java.opts`. Use Java 11, 17, or 21.

### Limitations

- `UseNativeQuery` / `EnableNativeParameterizedQuery` are Simba-specific, ignored by OSS
- `thriftTransport` parameter is ignored
- Logging output not suppressed (driver jar is not shaded)

## Classpath Management

`databricks.JDBCConnection` adds the driver jar automatically. For `StandaloneJDBCConnection`, add manually:

```matlab
javaaddpath("path/to/Shaded-Databricks-JDBC-Driver-0.0.2.jar");
```

## Proxy Support

JDBC driver supports SOCKS proxies only. Use `connectionURLAppend`:

```matlab
j = databricks.JDBCConnection(connectionURLAppend="ProxyHost=myproxy;ProxyPort=1080;");
```

## StandaloneJDBCConnection Constraints

`StandaloneJDBCConnection` supports the Simba driver only. Do not use `useDriverType="oss"` with standalone connections.

----

Copyright 2026 The MathWorks, Inc.

----
deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
Agent Cost Reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
Agent Cost Reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall