Skip to content

Commit 58e7daa

Browse files
committed
add core ssl config params
1 parent d3c767d commit 58e7daa

4 files changed

Lines changed: 47 additions & 0 deletions

File tree

src/main/java/com/databricks/jdbc/api/impl/DatabricksConnectionContext.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,16 @@ public int getHttpConnectionPoolSize() {
790790
return Integer.parseInt(getParameter(DatabricksJdbcUrlParams.HTTP_CONNECTION_POOL_SIZE));
791791
}
792792

793+
@Override
794+
public boolean allowSelfSignedCerts() {
795+
return getParameter(DatabricksJdbcUrlParams.ALLOW_SELF_SIGNED_CERTS).equals("1");
796+
}
797+
798+
@Override
799+
public boolean useSystemTrustStore() {
800+
return getParameter(DatabricksJdbcUrlParams.USE_SYSTEM_TRUST_STORE).equals("1");
801+
}
802+
793803
@Override
794804
public List<Integer> getUCIngestionRetriableHttpCodes() {
795805
return Arrays.stream(

src/main/java/com/databricks/jdbc/api/internal/IDatabricksConnectionContext.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,4 +260,37 @@ public interface IDatabricksConnectionContext {
260260

261261
/** Returns the socket timeout in seconds for HTTP connections. */
262262
int getSocketTimeout();
263+
264+
/**
265+
* Returns whether self-signed certificates are allowed for SSL connections.
266+
*
267+
* <p>When true, the driver will accept any certificate, including self-signed certificates. This
268+
* option is insecure and should only be used in non-production environments.
269+
*
270+
* @return true if self-signed certificates are allowed, false otherwise
271+
*/
272+
boolean allowSelfSignedCerts();
273+
274+
/**
275+
* Returns whether the system property trust store should be used for SSL certificate validation.
276+
*
277+
* <p>When true, the driver will use either:
278+
*
279+
* <ol>
280+
* <li>The trust store specified by the Java system property <code>javax.net.ssl.trustStore
281+
* </code> if set
282+
* <li>Or the JDK's default trust store (cacerts) if no system property is set
283+
* </ol>
284+
*
285+
* <p>When false, the driver will:
286+
*
287+
* <ol>
288+
* <li>Use the custom trust store specified by the SSLTrustStore parameter if provided
289+
* <li>Or use the JDK's default trust store (cacerts) but ignore any javax.net.ssl.trustStore
290+
* system property
291+
* </ol>
292+
*
293+
* @return true if the system property trust store should be used, false otherwise
294+
*/
295+
boolean useSystemTrustStore();
263296
}

src/main/java/com/databricks/jdbc/common/DatabricksJdbcUrlParams.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ public enum DatabricksJdbcUrlParams {
106106
"EnableComplexDatatypeSupport",
107107
"flag to enable native support of complex data types as java objects",
108108
"0"),
109+
ALLOW_SELF_SIGNED_CERTS("AllowSelfSignedCerts", "Allow self signed certificates", "0"),
110+
111+
USE_SYSTEM_TRUST_STORE("UseSystemTrustStore", "Use system trust store for SSL", "0"),
109112
ROWS_FETCHED_PER_BLOCK(
110113
"RowsFetchedPerBlock",
111114
"The maximum number of rows that a query returns at a time.",

src/main/java/com/databricks/jdbc/model/telemetry/enums/DatabricksDriverErrorCode.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ public enum DatabricksDriverErrorCode {
3232
JSON_PARSING_ERROR,
3333
CATALOG_OR_SCHEMA_FETCH_ERROR,
3434
SDK_CLIENT_ERROR,
35+
SSL_HANDSHAKE_ERROR,
3536
}

0 commit comments

Comments
 (0)