File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
main/java/com/databricks/client/jdbc
test/java/com/databricks/jdbc/integration/fakeservice/tests Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,10 @@ public boolean acceptsURL(String url) {
4343
4444 @ Override
4545 public Connection connect (String url , Properties info ) throws DatabricksSQLException {
46+ if (!acceptsURL (url )) {
47+ // Return null connection if URL is not accepted - as per JDBC standard.
48+ return null ;
49+ }
4650 IDatabricksConnectionContext connectionContext =
4751 DatabricksConnectionContextFactory .create (url , info );
4852
Original file line number Diff line number Diff line change 33import static com .databricks .jdbc .integration .IntegrationTestUtil .*;
44import static org .junit .jupiter .api .Assertions .*;
55
6- import com .databricks .jdbc .exception .DatabricksParsingException ;
76import com .databricks .jdbc .exception .DatabricksSQLException ;
87import com .databricks .jdbc .exception .DatabricksSQLFeatureNotSupportedException ;
98import com .databricks .jdbc .integration .fakeservice .AbstractFakeServiceIntegrationTests ;
@@ -39,10 +38,8 @@ void testFailureToLoadDriver() {
3938 @ Test
4039 void testInvalidURL () {
4140 Exception exception =
42- assertThrows (
43- DatabricksParsingException .class ,
44- () -> getConnection ("jdbc:abcde://invalidhost:0000/db" ));
45- assertTrue (exception .getMessage ().contains ("Invalid url" ));
41+ assertThrows (SQLException .class , () -> getConnection ("jdbc:abcde://invalidhost:0000/db" ));
42+ assertTrue (exception .getMessage ().contains ("No suitable driver found for" ));
4643 }
4744
4845 @ Test
You can’t perform that action at this time.
0 commit comments