Describe the bug
The Databricks JDBC driver throws a NullPointerException when connecting with an invalid JDBC URI that does not contain the required connection parameters (e.g. httpPath).
To Reproduce
- Use an invalid Databricks JDBC URI, for example (e.g.
jdbc:databricks://localhost:8080)
- Attempt to connect to the database using the URI
Sample code:
String databricksUrl = "jdbc:databricks://localhost:8080";
Properties properties = new Properties();
Driver driver = DriverManager.getDriver(databricksUrl);
try (Connection connection = driver.connect(databricksUrl, properties)) {
System.out.println("Connected to Databricks successfully!");
}
Expected behavior
The driver should throw a meaningful exception indicating that the JDBC URI is invalid or missing required connection parameters.
Client side logs
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.length()" because "this.text" is null
at java.base/java.util.regex.Matcher.getTextLength(Matcher.java:1769)
at java.base/java.util.regex.Matcher.reset(Matcher.java:415)
at java.base/java.util.regex.Matcher.<init>(Matcher.java:252)
at java.base/java.util.regex.Pattern.matcher(Pattern.java:1134)
at com.databricks.jdbc.api.impl.DatabricksConnectionContext.buildCompute(DatabricksConnectionContext.java:1324)
at com.databricks.jdbc.api.impl.DatabricksConnectionContext.<init>(DatabricksConnectionContext.java:76)
at com.databricks.jdbc.api.impl.DatabricksConnectionContext.parse(DatabricksConnectionContext.java:191)
at com.databricks.jdbc.api.impl.DatabricksConnectionContextFactory.create(DatabricksConnectionContextFactory.java:20)
at com.databricks.client.jdbc.Driver.connect(Driver.java:56)
Client Environment:
- OS: Mac OS Sonoma 14.3.1
- Java version: 17
- Java vendor: OpenJDK
- Driver Version: 3.4.2
Describe the bug
The Databricks JDBC driver throws a NullPointerException when connecting with an invalid JDBC URI that does not contain the required connection parameters (e.g.
httpPath).To Reproduce
jdbc:databricks://localhost:8080)Sample code:
Expected behavior
The driver should throw a meaningful exception indicating that the JDBC URI is invalid or missing required connection parameters.
Client side logs
Client Environment: