Databricks JDBC for Essbase 21c: Java 8 and Auth_Scope
Essbase 21c Databricks JDBC 403: Scopes 'all-apis' are not assigned to the client. Java 8 driver that honors Auth_Scope.
Share on LinkedIn
Why we ended up here
We had a simple goal. Essbase 21c needed to read data from an Azure Databricks SQL Warehouse over JDBC. For authentication we used OAuth machine-to-machine with a Databricks service principal, and we limited that principal's secret to the sql scope. If the secret ever leaks, someone can run SQL with it, but they can't use it against the rest of the Databricks REST API.
There was one catch from the start. Essbase 21c runs on Java 8, so any JDBC driver it loads has to be compiled for Java 8 (class file major version 52 or lower).
The published Databricks JDBC driver couldn't give us either piece. It ignored our scope, and it won't load on Java 8.
The 403 that started it
Every connection attempt failed at the OAuth token request. When we put a proxy in front of the driver, we could see it posting this body to /oidc/v1/token:
grant_type=client_credentials&scope=all-apisDatabricks rejected it with an HTTP 403:
{"error":"access_denied","error_description":"Scopes 'all-apis' are not assigned to the client"}In the client tools it showed up as oauth-m2m auth: Failed to refresh credentials: access_denied.
The natural fix was to add Auth_Scope=sql to the JDBC URL. We did, and nothing changed. The driver kept asking for all-apis.
What was going on in the driver
The open-source driver already reads Auth_Scope. It uses the value for browser-based U2M login and for private-key JWT M2M. The plain client-secret M2M path never passed it along, though. ClientConfigurator.setupM2MConfig() simply never calls databricksConfig.setScopes(...).
When the Databricks Java SDK gets no scopes, getScopes() falls back to ["all-apis"]. So every client-secret token request asked for all-apis, no matter what we put in the URL, and a secret limited to sql could never pass.
We weren't the only ones to hit this. The bug is tracked upstream as issue #1706, and the fix is PR #1707.
Why we couldn't just wait for the fix
When we needed the connection working, PR #1707 was still open. It merged on 2026-10-05 and first shipped in v3.4.4 on 2026-10-22.
Even the official fix doesn't help Essbase 21c. Every published databricks-jdbc release, 3.4.4 included, is compiled for Java 11, and Maven Central has no Java 8 build. If you put a Java 11 JAR on Essbase, the JVM refuses to load it with an UnsupportedClassVersionError.
We also couldn't copy the upstream change into a Java 8 build as-is, because it uses Java 11 APIs like String.isBlank(), String.strip() and List.of().
That left three ways to wait it out, and we didn't like any of them. We could leave the connection broken, give the secret all-apis access just to get past the bug, or wait for an Essbase release on a newer Java with no date in sight.
Building a patched driver
Databricks keeps a jdk-8 branch of the driver. It compiles to Java 1.8 and pins the dependencies that still support Java 8, including Arrow 13, Mockito 4.11 and nimbus-jose-jwt 9.47. When we built, the branch was at commit 6d3a31b3 from 2026-03-12 (version 3.2.2-SNAPSHOT), and it didn't have the scope fix yet.
The change itself is small. It touches two files and uses only Java 8 APIs.
- A new helper,
DatabricksAuthUtil.parseOAuthScopes(String), splitsAuth_Scopeon whitespace or commas. It returns an empty list for null or blank input. ClientConfigurator.setupM2MConfig()now applies those scopes on the plain client-secret path:
List<String> scopes = DatabricksAuthUtil.parseOAuthScopes(connectionContext.getAuthScope());
if (!scopes.isEmpty()) {
databricksConfig.setScopes(new ArrayList<>(scopes));
}If you don't set Auth_Scope, nothing changes, and the SDK still asks for all-apis. We left the GCP, Azure AD tenant, JWT-assertion and U2M paths alone.
We gave the build the version 3.2.2-jdk8-authscope.1, so nobody confuses it with an official release. We did leave the driver's internal DRIVER_VERSION constant at 3.2.1. The driver sends that value to Databricks in its User-Agent header, and we didn't want to change what the server sees.
How we checked it
We built with Temurin JDK 1.8.0_504 and Maven 3.10.0. Before changing anything, we built the untouched jdk-8 branch to make sure it compiled cleanly, so any later failure would point at our patch.
After the change, all 117 unit tests in the affected areas passed. The new tests cover three cases. Auth_Scope=sql produces [sql], no Auth_Scope still produces [all-apis], and sql offline_access produces both scopes.
We also checked every class in the 39 MB shaded JAR, all 23,763 of them, and none is newer than Java 8 (major version 52). On a real Java 8 runtime, Class.forName("com.databricks.client.jdbc.Driver") loads the driver without errors.
The underscore that cost us a test run
Our first test in DBeaver still sent scope=all-apis, which was confusing for a minute. The URL said AuthScope=sql. The driver only recognizes Auth_Scope, with the underscore, and it quietly ignores properties it doesn't know. So the misspelled name fell back to the default and produced the same 403 as the original bug.
We ran each spelling against the built JAR to confirm it:
AuthScope=sql -> [all-apis]
Auth_Scope=sql -> [sql]
auth_scope=sql -> [sql]
(none) -> [all-apis]Capitalization doesn't matter, but the underscore does. If you still see all-apis after deploying the patched driver, check this first.
Deploying it on Essbase 21c
The driver class is com.databricks.client.jdbc.Driver.
Replace your existing Databricks JDBC JAR rather than adding this one next to it. Keep only one Databricks driver on the classpath. The older Simba-based Databricks driver uses the same class name, and if both are present you can't be sure which one gets loaded.
Here is the URL format:
jdbc:databricks://<workspace-host>:443/default;transportMode=http;ssl=1;httpPath=/sql/1.0/warehouses/<warehouse-id>;AuthMech=11;Auth_Flow=1;OAuth2ClientId=<client-id>;OAuth2Secret=<secret>;Auth_Scope=sqlAuthMech=11 turns on OAuth 2.0, and Auth_Flow=1 picks the client credentials flow. If you used a proxy while testing, remove UseProxy, ProxyHost and ProxyPort before this goes to production.
The JAR, the patch and a small Java 8 test class are in the companion repo. Keep in mind this is an unofficial build.
Where upstream stands now
As of 2026-10-26, issue #1706 is closed, and v3.4.4 honors Auth_Scope for client-secret M2M. It's still a Java 11 build, so Essbase 21c can't use it.
The good news is on the jdk-8 branch. Databricks synced it to 3.4.3 on 2026-10-07, and it now includes the scope fix while still compiling to Java 1.8. They still don't publish a Java 8 binary, so you have to build that branch yourself. If you'd rather not carry our patch, that's the way to go. One small difference is that their parser splits scopes on whitespace only, while ours also accepts commas. For Auth_Scope=sql the two behave the same.
Things to watch for
Spell the property Auth_Scope. Without the underscore, the driver ignores it and you get the same 403 as the original bug.
Keep a single Databricks driver JAR on the Essbase classpath. Two drivers with the class name com.databricks.client.jdbc.Driver will conflict.
Be careful with proxy captures. The Authorization: Basic header is base64 of client_id:client_secret, so anyone who sees the capture can read your secret. Redact it before sharing, and rotate the secret if it ever ends up in a chat or a ticket.
Don't widen the secret to make the error go away. Granting all-apis hides the driver bug and gives the secret more access than Essbase needs. Keep the secret at sql and fix the driver.
What's next
This JAR is the patched 3.2.2 build we used to get unblocked. Databricks has since put the Auth_Scope fix on the jdk-8 branch, but they still don't ship a Java 8 binary.
The next part shows how we caught the bad scope with a local proxy, then walks through building that branch from source, so you can drop our custom patch and compile what they already have.



Comments
Plain text only. No account needed — blank name shows as Anonymous. You can reply once under any top-level comment.
Loading…