https://github.com/databricks/databricks-jdbc
JDBC for Databricks SQL
https://github.com/databricks/databricks-jdbc
Last synced: 4 days ago
JSON representation
JDBC for Databricks SQL
- Host: GitHub
- URL: https://github.com/databricks/databricks-jdbc
- Owner: databricks
- License: apache-2.0
- Created: 2023-06-19T08:21:22.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2026-03-27T14:16:13.000Z (9 days ago)
- Last Synced: 2026-03-27T17:45:55.144Z (9 days ago)
- Language: Java
- Homepage: https://docs.databricks.com/aws/en/integrations/jdbc-oss/
- Size: 140 MB
- Stars: 34
- Watchers: 6
- Forks: 36
- Open Issues: 48
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Notice: NOTICE
- Dco: DCO
Awesome Lists containing this project
README
# Databricks JDBC Driver
The Databricks JDBC driver implements the JDBC interface providing connectivity to a Databricks SQL warehouse.
Please refer to [Databricks documentation](https://docs.databricks.com/aws/en/integrations/jdbc-oss/) for more
information.
[](https://opensource.org/licenses/Apache-2.0)
## Prerequisites
Databricks JDBC is compatible with Java 11 and higher. CI testing runs on Java versions 11, 17, and 21.
## Installation
### Maven
Add the following dependency to your `pom.xml`:
```xml
com.databricks
databricks-jdbc
3.3.1
```
### Build from Source
This is a multi-module Maven project:
| Module | Artifact | Description |
|--------|----------|-------------|
| `jdbc-core` | `databricks-jdbc-core` | Core driver code |
| `assembly-uber` | `databricks-jdbc` | Uber jar with all dependencies bundled |
| `assembly-thin` | `databricks-jdbc-thin` | Thin jar (dependencies not bundled) |
| `test-assembly-uber` | `test-databricks-jdbc-uber` | Packaging tests for the uber jar |
| `test-assembly-thin` | `test-databricks-jdbc-thin` | Packaging tests for the thin jar |
1. Clone the repository
2. Build the driver jar (equivalent to `mvn clean package -DskipTests` in a single-module project):
```bash
mvn -pl jdbc-core,assembly-uber,assembly-thin clean package -DskipTests -Ddependency-check.skip=true
```
3. The uber jar is generated at `assembly-uber/target/databricks-jdbc-.jar`
4. To run unit tests and generate a coverage report (equivalent to `mvn clean test` in a single-module project):
```bash
mvn -pl jdbc-core clean test jacoco:report -Dgroups='!Jvm17PlusAndArrowToNioReflectionDisabled' -Ddependency-check.skip=true
```
The test coverage report is generated in `jdbc-core/target/site/jacoco/index.html`
## Usage
### Connection String
```
jdbc:databricks://:;transportMode=http;ssl=1;AuthMech=3;httpPath=;UID=token;PWD=
```
### Authentication
The JDBC driver supports the following authentication methods:
#### Personal Access Token (PAT)
Use `AuthMech=3` for personal access token authentication:
```
AuthMech=3;UID=token;PWD=
```
#### OAuth2 Authentication
Use `AuthMech=11` for OAuth2-based authentication. Several OAuth flows are supported:
##### Token Passthrough
Direct use of an existing OAuth token:
```
AuthMech=11;Auth_Flow=0;Auth_AccessToken=
```
##### OAuth Client Credentials (Machine-to-Machine)
Configure standard OAuth client credentials flow:
```
AuthMech=11;Auth_Flow=1;OAuth2ClientId=;OAuth2Secret=
```
Optional parameters:
- `AzureTenantId`: Azure tenant ID for Azure Databricks (default: null). If enabled, the driver will include refreshed
Azure Active Directory (AAD) Service Principal OAuth tokens with every request.
##### Browser-Based OAuth
Interactive browser-based OAuth flow with PKCE:
```
AuthMech=11;Auth_Flow=2
```
Optional parameters:
- `OAuth2ClientId` - Client ID for OAuth2 (default: databricks-cli)
- `OAuth2RedirectUrlPort` - Ports for redirect URL (default: 8020)
- `EnableOIDCDiscovery` - Enable OIDC discovery (default: 1)
- `OAuthDiscoveryURL` - OIDC discovery endpoint (default: /oidc/.well-known/oauth-authorization-server)
- `EnableSQLValidationForIsValid` - Enable SQL query based validation in `isValid()` connection checks (default: 0)
### Logging
The driver supports logging configuration via JDBC URL parameters or system properties. For detailed configuration options, see [Logging Documentation](./docs/LOGGING.md).
## Running Tests
Basic test execution:
```bash
mvn test
```
**Note**: Due to a change in JDK 16 that introduced a compatibility issue with the Apache Arrow library used by the JDBC
driver, runtime errors may occur when using the JDBC driver with JDK 16 or later. To avoid these errors, restart your
application or driver with the following JVM command option:
```
--add-opens=java.base/java.nio=org.apache.arrow.memory.core ALL-UNNAMED
```
For more detailed information about integration tests and fake services, see [Testing Documentation](./docs/TESTING.md).
## Documentation
For more information, see the following resources:
- [Integration Tests Guide](./docs/TESTING.md)
- [Logging Configuration](./docs/LOGGING.md)