Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
- `DatabaseMetaData.getColumns(...)` with a `null` catalog now issues a single `SHOW COLUMNS IN ALL CATALOGS` statement (consistent with `getSchemas`/`getTables`) instead of enumerating every catalog and issuing a per-catalog `SHOW COLUMNS`. Older DBR versions that do not support the syntax transparently fall back to the previous enumerate-and-fan-out behavior.

### Fixed
- `DatabricksSQLFeatureNotImplementedException` now follows the JDBC contract by extending
`SQLFeatureNotSupportedException`, while continuing to emit the existing
`NOT_IMPLEMENTED_OPERATION` telemetry error.

- Fixed `IdleConnectionEvictor` thread leak in long-running applications. Driver-side resources (HTTP client, background threads) are now always released when `Connection.close()` is called, even if statement cleanup or server-side session termination fails.

- Throw `DatabricksSQLException` instead of an unchecked `ClassCastException` when a complex-type getter (`getArray`, `getStruct`, `getMap`) is called on a column of a different complex type.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
package com.databricks.jdbc.exception;

import com.databricks.jdbc.common.TelemetryLogLevel;
import com.databricks.jdbc.common.util.DatabricksThreadContextHolder;
import com.databricks.jdbc.model.telemetry.enums.DatabricksDriverErrorCode;
import com.databricks.jdbc.telemetry.TelemetryHelper;
import java.sql.SQLFeatureNotSupportedException;

public class DatabricksSQLFeatureNotImplementedException extends DatabricksSQLException {
public class DatabricksSQLFeatureNotImplementedException extends SQLFeatureNotSupportedException {

public DatabricksSQLFeatureNotImplementedException(String reason) {
super(reason, DatabricksDriverErrorCode.NOT_IMPLEMENTED_OPERATION);
super(reason, DatabricksDriverErrorCode.NOT_IMPLEMENTED_OPERATION.name());
TelemetryHelper.exportFailureLog(
DatabricksThreadContextHolder.getConnectionContext(),
DatabricksDriverErrorCode.NOT_IMPLEMENTED_OPERATION.name(),
reason,
TelemetryLogLevel.ERROR);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.databricks.jdbc.exception;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.mockito.Mockito.mockStatic;

import com.databricks.jdbc.common.TelemetryLogLevel;
import com.databricks.jdbc.common.util.DatabricksThreadContextHolder;
import com.databricks.jdbc.model.telemetry.enums.DatabricksDriverErrorCode;
import com.databricks.jdbc.telemetry.TelemetryHelper;
import java.sql.SQLFeatureNotSupportedException;
import org.junit.jupiter.api.Test;
import org.mockito.MockedStatic;

class DatabricksSQLFeatureNotImplementedExceptionTest {

@Test
void followsJdbcContractAndPreservesTelemetry() {
String reason = "Not implemented";
DatabricksSQLFeatureNotImplementedException exception;
try (MockedStatic<TelemetryHelper> telemetryHelper = mockStatic(TelemetryHelper.class)) {
exception = new DatabricksSQLFeatureNotImplementedException(reason);

telemetryHelper.verify(
() ->
TelemetryHelper.exportFailureLog(
DatabricksThreadContextHolder.getConnectionContext(),
DatabricksDriverErrorCode.NOT_IMPLEMENTED_OPERATION.name(),
reason,
TelemetryLogLevel.ERROR));
}

assertInstanceOf(SQLFeatureNotSupportedException.class, exception);
assertEquals(
DatabricksDriverErrorCode.NOT_IMPLEMENTED_OPERATION.name(), exception.getSQLState());
assertEquals(0, exception.getErrorCode());
}
}
Loading