hyunw9 opened a new pull request, #5276:
URL: https://github.com/apache/zeppelin/pull/5276

    What is this PR for?
   
     The JDBC interpreter forwards all of an interpreter's prefixed properties 
(default.*) straight to the JDBC driver when opening a connection. Many of 
these keys are consumed by Zeppelin itself or by the DBCP connection pool — 
e.g. driver, url, precode, statementPrecode,
     completer.ttlInSeconds, validationQuery, maxIdle — and are not valid JDBC 
connection properties.
   
     Lenient drivers (PostgreSQL, MySQL) silently ignore unknown properties, so 
this went unnoticed. But strict drivers reject the connection outright. For 
example, DuckDB fails with:
   
     SQLException: Invalid Input Error: The following options were not 
recognized:
                   completer.ttlInSeconds, url, driver, maxIdle
   
     This currently makes it impossible to use DuckDB (and other strict drivers 
such as MS SQL Server) with the JDBC interpreter.
   
     Until now this was worked around with a driver-specific whitelist that 
only applied when the driver class was Presto/Trino (PRESTO_PROPERTIES). That 
approach is hard to maintain: every new strict driver needs its own if branch 
and allow-list, and it also strips any legitimate driver
     property the user added but that wasn't on the list.
   
     This PR replaces that with a generic, driver-agnostic deny-list:
   
     - Introduces NON_DRIVER_PROPERTIES, a single source of truth listing only 
Zeppelin-internal and DBCP pool keys (user/password are deliberately kept, 
since they are standard JDBC properties).
     - Adds toDriverProperties(), which returns a filtered copy of the 
properties handed to the driver, leaving the original untouched (the previous 
Presto code mutated the shared per-user Properties in place — a latent bug).
     - Removes the Presto/Trino special-case branch and the PRESTO_PROPERTIES 
whitelist; the generic filter subsumes it.
     - Adds an optional escape hatch, zeppelin.jdbc.driver.excludeProperties 
(comma-separated), so operators can exclude additional keys for future drivers 
without a code change.
   
     Result: DuckDB, MS SQL Server, Trino/Presto, and any future strict driver 
work through one consistent rule, while genuine driver properties (e.g. SSL, 
useSSL, sslmode) still pass through unchanged.
   
     What type of PR is it?
   
     Bug Fix
   
     Todos
   
     - [x] Replace Presto/Trino whitelist with a generic internal-property 
deny-list
     - [x] Keep user/password and arbitrary driver properties (e.g. SSL) 
flowing to the driver
     - [x] Add unit tests for the filtering logic
     - [x] Add end-to-end tests against real strict drivers (DuckDB embedded, 
Trino)
   
   | Property setting (1) | Property setting (2) |
     |:---:|:---:|
     | <img width="2507" height="963" alt="스크린샷 2026-06-25 오후 9 20 23" 
src="https://github.com/user-attachments/assets/9c32bab8-d6d5-4096-b90a-5fa59e434509";
 /> | <img width="2083" height="139" alt="스크린샷 2026-06-25 오후 9 20 29" 
src="https://github.com/user-attachments/assets/2e0d2320-59eb-4efb-b28d-0f9bf5e7bc5f";
 /> |
   
     **2. Result — Before / After**
   
     | Before — DuckDB connection error | After — connected successfully |
     |:---:|:---:|
     | <img width="2462" height="206" alt="before-duckdb-error" 
src="https://github.com/user-attachments/assets/9b204002-9373-44a1-8d9b-1e41da30e4f6";
 /> | <img width="2475" height="517" alt="after-success" 
src="https://github.com/user-attachments/assets/417141ca-f780-4e58-8f55-0c32f9d6102c";
 />
     |
   
     What is the Jira issue?
   
     - [ZEPPELIN-6208](https://issues.apache.org/jira/browse/ZEPPELIN-6208)
   
     How should this be tested?
   
     Automated tests added in JDBCInterpreterTest:
   
     - testToDriverProperties — internal/pool keys are removed; user, password, 
and arbitrary driver props (SSL) are kept; the original Properties is not 
mutated.
     - testToDriverPropertiesWithUserDefinedExcludes — 
zeppelin.jdbc.driver.excludeProperties strips additional user-specified keys.
     - testDuckDbConnectionWithInternalProperties — end-to-end: configures the 
interpreter with internal keys present and runs CREATE/INSERT/SELECT against an 
embedded DuckDB (no server needed). Fails on the old code, passes here.
     - testTrinoConnectionWithInternalProperties — end-to-end against a real 
Trino coordinator; auto-skipped via assumeTrue when none is reachable on 
localhost:8080.
   
     mvn -pl jdbc -am test -Dtest=JDBCInterpreterTest
   
     Manual: add a JDBC interpreter with 
default.driver=org.duckdb.DuckDBDriver, default.url=jdbc:duckdb:, add the 
org.duckdb:duckdb_jdbc dependency in the interpreter settings, leave an 
internal key such as default.completer.ttlInSeconds=120, and run a query — it 
now connects successfully.
   
   
   
     Questions:
   
     - Does the license files need to update? - X
     - Is there breaking changes for older versions? - X
     - Does this need documentation? - Optional 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to